KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is it possible to make curl, access a url and the result as a file resource? like how fopen does it. My goals: Parse a CSV file Pass it to fgetcsv My obstruction: fopen is disabled My chunk of codes (in fopen) $url = "http://download.finance.yahoo.com/d/quotes.csv?s=USDEUR=X&f=sl1d1t1n&e=.csv"; $f = fopen($url, 'r'); print_r(fgetcsv($f)); Then, I am trying this on curl. $curl = curl_init(); curl_setopt($curl, CURLOPT_VERBOSE, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, false); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $param); curl_setopt($curl, CURLOPT_URL, $url); $content = @curl_exec($curl); curl_close($curl); But, as usual. $content already returns a string. Now, is it possible for curl to return it as a file resource pointer? just like fopen? Using PHP < 5.1.x something. I mean, not using str_getcsv, since it's only 5.3. My error Warning: fgetcsv() expects parameter 1 to be resource, boolean given Thanks
Tags (comma-separated)
Save Edits
Cancel