Forum Moderators: coopster
If I have say a plain text file on a server containing 'phpinfo();'
And I wanted a PHP on another server to read that string and executing it as a PHP. I saw some pages sometime ago that has a working code to implement that.
I was like "Interesting. But I have no need for that....click onnnn" so I surfed away without bookmarking. Now that I need it I couldn't find that page.
I am aware of that include function.
But it only include the generated code as a normal text. Say for a remote phpinfo();
It will retrieve the html generated by the remote server then it get included in my PHP.
I wanted it to read the code 'phpinfo()' froom the remote server, then execute that command on my machine instead.
text.txton your example.com web site and it contains this line...
phpinfo();
<?php
$file_get_contents = file_get_contents('http://example.com/text.txt');
print eval($file_get_contents);
?>
I tried it out only to get an error msg:
Warning: file_get_contents(http://www.myserver.com/phpinfo.txt): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/myserv/public_html/generate.php(39) : eval()'d code on line 1
[edited by: haryanto at 1:56 am (utc) on Aug. 10, 2004]
Thanks all, especially coopster and jolly!
Have a jlly good day!
YOu guys just made my day
But what if the remote PHP contains strings like
<html>
phpinfo();
</html>
I know the '<' and the '>' will crash my eval()
I tried add slashes to the string but they dont work!
$what = file_get_contents('http://www.example.com/test.phps');
$myString = addslashes($what);
print eval($myString);