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