Good day.
cURL'om download the file

curl_setopt($this->curl, CURLOPT_FILE, $url); $html = curl_exec($this->curl); 

then through the same variable I'm trying to get a web page

 curl_setopt($this->curl, CURLOPT_FILE, null); curl_setopt($this->curl, CURLOPT_URL, $url); $html = curl_exec($this->curl); 

PHP (5.3) swears -

Warning: curl_setopt (): Supplied File / Hand resource in /var/www/wild-parser/parser_v2/lib/web.php on line 137

on php 5.5 no problem ...

    1 answer 1

    Do not change the CURLOPT_FILE option - a valid file is expected there, null will not work.

    Instead, set the CURLOPT_RETURNTRANSFER, TRUE option so that the result is returned by the curl_exec() . The same will cancel the effect of the previously installed CURL_FILE option in PHP before 5.3.9. Having this version of one RETURNTRANSFER not enough. It is necessary to execute in the beginning

     curl_setopt($ch, CURLOPT_FILE, fopen('php://stdout', 'w')); 

    And do not forget to disable the HTTP headers in the response: CURLOPT_HEADER, FALSE .