MDanz Posted March 21, 2010 Share Posted March 21, 2010 i'm trying this below but it isn't working, the page is coming up blank. <?php $url = 'http://www.realgm.com'; function get_url_contents($url){ $crl = curl_init(); $timeout = 5; curl_setopt ($crl, CURLOPT_URL,$url); curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout); $ret = curl_exec($crl); curl_close($crl); return $ret; } ?> Link to comment https://forums.phpfreaks.com/topic/196024-curl-webpage-into-string-variable-help/ Share on other sites More sharing options...
devofash Posted March 21, 2010 Share Posted March 21, 2010 Have you got curl enabled? If yes, I cant see you calling the function in the your script. Are you calling it? Link to comment https://forums.phpfreaks.com/topic/196024-curl-webpage-into-string-variable-help/#findComment-1029630 Share on other sites More sharing options...
MDanz Posted March 21, 2010 Author Share Posted March 21, 2010 i got it from here http://www.howtogeek.com/howto/programming/php-get-the-contents-of-a-web-page-rss-feed-or-xml-file-into-a-string-variable/ how do i call a function? i'm still a newbie when it comes to coding. Link to comment https://forums.phpfreaks.com/topic/196024-curl-webpage-into-string-variable-help/#findComment-1029635 Share on other sites More sharing options...
devofash Posted March 21, 2010 Share Posted March 21, 2010 put the below line outside the function. echo get_url_contents($url); Link to comment https://forums.phpfreaks.com/topic/196024-curl-webpage-into-string-variable-help/#findComment-1029639 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.