Making a file do something remotly?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Mr. Tech
Forum Contributor
Posts: 205
Joined: Tue Feb 11, 2003 4:18 pm
Location: Australia

Making a file do something remotly?

Post by Mr. Tech »

While I am on one page, I want to trigger another page to add info to a MySQL database.

If that makes sense(Please let me know if it doesn't), is this what I would do:

Code: Select all

<?php
echo "This is the first page!";

// Below is the page which adds the mysql data:
$handle = fopen ("http://www.mydomain.com/page.php?insert=true", "r");
?>
It just doesn't seem to work... I get no errors but nothing is added to the database.
Drachlen
Forum Contributor
Posts: 153
Joined: Fri Apr 25, 2003 1:16 am

Post by Drachlen »

Code: Select all

<?php 
echo "This is the first page!"; 

// Below is the page which adds the mysql data: 
include("Yourfile.php");
?>

The thing is, when i tried using ?insert=true it couldnt find it... So you could put the ?insert=true on that page. so if the first page was called 'firstpage.php' you would put yourlink.com/firstpage.php?insert=true which will be picked up in the included file, if it has an if checking for it..

fopen isnt for viewing, you would have to make a couple more steps, and thats what include is for. fopen would be if you wanted to modify the data inside of the opened file..
Tubbietoeter
Forum Contributor
Posts: 149
Joined: Fri Mar 14, 2003 2:41 am
Location: Germany

Post by Tubbietoeter »

have a look at this, maybe this will help you:

http://de.php.net/manual/en/function.popen.php
Post Reply