Home » Categories » PHP Tricks

Curl Image using php but empty file is created

//Init curl
$ch = curl_init ($url);

//Required to be false
curl_setopt($ch, CURLOPT_HEADER, 0);

//Required for http(s)
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

//Required to be true
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);

//Response data

curl_close ($ch);



Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
Attachments Attachments
There are no attachments for this article.
Comments Comments
There are no comments for this article. Be the first to post a comment.
Related Articles RSS Feed
Extract numbers from a string
Viewed 304 times since Mon, Sep 14, 2020