Hi, can someone please help me resolve the following error curl_setopt(): supplied argument is not a valid File-Handle resource You can see the error message by going here http://www.systemsrecovery.info/default.php The code I am using is as follows: $url ="http://groups.google.com/group/sci.agriculture.beekeeping/feed/rss_v2_0_topics.xml"; $file = $url; $ch = curl_init($file); $fp = @fopen("temp.xml", "w"); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); $file = "temp.xml"; $fp = fopen($file, "r"); Thanks for all/ any help Regards Markus
I didn't expect it to work after the change, but I was hoping for an additional error message caused by fopen(). But I've just seen you're not silencing the error on the second fopen() on the same file, and the errors on your page show that there's no temp.xml file, and PHP can't create it. Try creating it manually in this directory, and make sure it's writable.
Great, thanks; I have just tried the code on another server and it works... It actually looks to me that the global variable CURLOPT_FILE might not be declared. How can I get this "turned on" in PHP? I do C# as a day job so a PHP guru I'm not
I don't think that's the problem. Some servers have different default file/folder permissions, and therefore PHP cannot always create these files. Try chmodding the folder you're currently working in to 755.
curl function use to extract data for xml or jason file there some argument passs problem for that error................
Try switch these two around & adding the return transfer option: curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FILE, $fp); PHP: