Lefu Posted April 10, 2008 Share Posted April 10, 2008 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 More sharing options...
uniflare Posted April 10, 2008 Share Posted April 10, 2008 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 More sharing options...
Caesar Posted April 10, 2008 Share Posted April 10, 2008 <?php $code = '<h1>hello world</h1>'; echo $code; ?> Link to comment https://forums.phpfreaks.com/topic/100403-solved-curl-results/#findComment-513477 Share on other sites More sharing options...
Caesar Posted April 10, 2008 Share Posted April 10, 2008 If you want to store php code in a variable or database, look into using eval(). Link to comment https://forums.phpfreaks.com/topic/100403-solved-curl-results/#findComment-513478 Share on other sites More sharing options...
uniflare Posted April 10, 2008 Share Posted April 10, 2008 copy cat Link to comment https://forums.phpfreaks.com/topic/100403-solved-curl-results/#findComment-513480 Share on other sites More sharing options...
Lefu Posted April 10, 2008 Author Share Posted April 10, 2008 Thank you, I am looking in to it as you read this. will let you know how it went. thanx to both of you. Link to comment https://forums.phpfreaks.com/topic/100403-solved-curl-results/#findComment-513481 Share on other sites More sharing options...
Lefu Posted April 10, 2008 Author Share Posted April 10, 2008 Thanks to both of you I have tested eval(), it worked with no pain. have a great week no make that a year. Link to comment https://forums.phpfreaks.com/topic/100403-solved-curl-results/#findComment-513794 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.