Page 1 of 1

Making a file do something remotly?

Posted: Wed Aug 06, 2003 6:32 pm
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.

Posted: Wed Aug 06, 2003 9:00 pm
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..

Posted: Thu Aug 07, 2003 3:23 am
by Tubbietoeter
have a look at this, maybe this will help you:

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