Jump to content

Recommended Posts

Dear all,

 

I have this code:

$ch = curl_init();

$timeout = 0; // set to zero for no timeout

curl_setopt ($ch, CURLOPT_URL, 'http://localhost/example/urlinclude.php?contentid=3');

curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

$file_contents = curl_exec($ch);

curl_close($ch);

echo $file_contents;

 

The results is

hello world' ?>
 

instead of

hello world

 

the code in urlinclude.php file is

$code = "echo '<h1>hello world</h1>' ";

echo "<? $code ?>";

 

I am fetching my code from the mysql db, I need to output the results on the screen.

allow_url_include=off

 

how can I achieve the results?

 

thanks a lot for your input.

Link to comment
https://forums.phpfreaks.com/topic/100403-solved-curl-results/
Share on other sites

this:

 

$code = "echo '<h1>hello world</h1>' ";
echo "<? $code ?>";

 

quite possible should be:

 

$code = "echo '<h1>hello world</h1>'; ";
echo '<?php $code ?>';

---------

 

so you want to grab a code from another server - and then execute it on yours? (dangerous but ah well):

 

look into eval() function - www.php.net/eval

 

Link to comment
https://forums.phpfreaks.com/topic/100403-solved-curl-results/#findComment-513476
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.