abdfahim Posted June 20, 2010 Share Posted June 20, 2010 hi experts, Can you please help me finding what wrong i am doing in the following code? The rss.txt file is created, but totally blank. I can see the last message "Done". <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://admin.dsebd.org/admin-real/datafile/quotes.txt'); $fp = fopen('rss.txt', 'w'); curl_setopt($ch, CURLOPT_FILE, $fp); curl_exec ($ch); curl_close ($ch); fclose($fp); echo "done"; ?> I am using freehostia for my hosting and its phpinfo shows following info abour CURL curl cURL support enabled cURL Information libcurl/7.11.2 OpenSSL/0.9.7e ipv6 zlib/1.2.2 Quote Link to comment https://forums.phpfreaks.com/topic/205312-php-curl-help/ Share on other sites More sharing options...
trq Posted June 20, 2010 Share Posted June 20, 2010 You never actually write anything to the file. All you do is open and close it. See fwrite. Quote Link to comment https://forums.phpfreaks.com/topic/205312-php-curl-help/#findComment-1074580 Share on other sites More sharing options...
abdfahim Posted June 20, 2010 Author Share Posted June 20, 2010 I am sorry, its my first attempt for using curl ... i tried many tutorials, but it seems Greek to me still Anyway, i thought the following line will write inside the file. If not, can you suggest me how to dload the content of the source text file to the target, any link suggested please? curl_setopt($ch, CURLOPT_FILE, $fp); Quote Link to comment https://forums.phpfreaks.com/topic/205312-php-curl-help/#findComment-1074587 Share on other sites More sharing options...
abdfahim Posted June 20, 2010 Author Share Posted June 20, 2010 Dear experts, I am really clueless. The same code works in my laptop (write the url content to rss.txt), but does not work in my server, though CURL is enable in my server also. I cant understand what is missing here. Here is the link to check the phpinfo of my server http://shareportfolio.freehostia.com/test.php Quote Link to comment https://forums.phpfreaks.com/topic/205312-php-curl-help/#findComment-1074629 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.