• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
curl and php file downloading

Hi, I've got one problem.
I want to download remote image using curl. To do this i'm using these isntructions:

This is usefull when you are downloading big files, as it
will prevent time out of the script :
ini_set('display_errors',true);//Just in case we get some errors, let us know....

$fp = fopen (dirname(__FILE__) . '/a.rss', 'w+');//This is the file where we save the information
$ch = curl_init('http://www.webdigity.com/rss.php');//Here is the file we are downloading
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

but it says that there is no such file or directory in (and this is weird) home/username/localhost/..
it gives the full system array to my localhost folder. Why?

When I'm doing this by:
It normally creates an image file in my main localhost folder, but i prefer to use curl. What's wrong?

Edit: ofc i know, that variable dirname(__FILE__) contains my full system path - but why? How can I do it same as in PHP without entering the full system path?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.