I am trying to execute code that is returned by a cURL query.
The following code queries a page on my webserver:
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, "http://web.com/foo.php");
curl_setopt ($ch, CURLOPT_HEADER, 0);
$res = curl_exec ($ch);
curl_close ($ch);
echo $res;
I would like to do so by only modifying the code in foo.php. I have tried returning PHP code as the result in foo.php with an eval() command but it doesn't seem to work.
Any ideas?
EDIT: Guys, I am not doing this for a public website. It is for a private project, I will be the only user. I know it's a huge security concern, I would never do something like this that would be live on the internet.
evalis the way to execute code received as strings, what exactly "doesn't seem to work"? Also: don't do it.evalisevil, and so on...</2cents-and-some-change>:)