Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remote PHP calls.

Status
Not open for further replies.

wu78754

Programmer
Nov 6, 2009
12
US
I have a simple question which I do not know the answer.

I have two programs: A.php and B.php.

From within A.php I call B.php.
B.php will return a random number.
A.php will then write that random number into a file.

My trouble is in passing the random number back into A.php.

Help!
 
Thanks.
I am not sure you can include a remote php file. It would be a security issue if you can.

I just found the answer I was looking for.

$exurl ='
if (!($contents = file_get_contents($exurl))) {
echo 'Could not open remote URL.';
}
else {
echo $contents;
}
 
ah. i did not understand that they were on separate file systems, although I saw that they were on separate web urls.

use file_get_contents then

Code:
$myRandomNumber = trim(file_get_contents('[URL unfurl="true"]http://www.domain.com/path/to/B.php'));[/URL]

assuming B.php just echos a random number to screen

Code:
echo md5(uniqid(mt_rand(), true));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top