Jump to content

PHP Curl Help


abdfahim

Recommended Posts

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 

Link to comment
https://forums.phpfreaks.com/topic/205312-php-curl-help/
Share on other sites

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);

Link to comment
https://forums.phpfreaks.com/topic/205312-php-curl-help/#findComment-1074587
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/205312-php-curl-help/#findComment-1074629
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.