hello!
lets say php script is here http://abc.com/a.php
this a.php works with inner mysql database "localhost" etc.
after all it returns answer like
echo "<b>".$country."</b>";
which is lets say outputs html <b>UK</b>
when i go to http://abc.com/a.php
it is fine, it shows me what i want it shows value of $country = <b>UK</b>;
but the problem is how do i get this value of $country from another location
lets say URL is like http://xyz.com/b.php ?
include did not work i did something wrong there...
how to evaluate things in php and then pass to another php script?
.............
in javascript there is no problem, all you have to do is do like this
<script src="http://abc.com/a.php"> </script>
and in javascript working space would be <b>UK</b>, which ofcourse leads to an error, but it is not a point
evaluate php script and pass php variable to aother php
Moderator: General Moderators
-
eugene2006
- Forum Newbie
- Posts: 19
- Joined: Fri Oct 28, 2005 6:09 pm
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Have a look http://ca3.php.net/manual/en/function.fopen.php
If the script is on the same server and you just want the output value, make a function to return the value and just use it in both places...
if it is on another server just do it like this:
if it is on another server just do it like this:
Code: Select all
$h= fopen('http://example.com/a.php', 'r');
$variable = fread($h);
fclose($h);
echo 'The country is: '.$variable;