$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://ift.tt/2z83Dtl');
curl_setopt($curl, CURLOPT_REFERER, 'http://www.example.com');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
header('Content-type:image/PNG');
echo $result;
curl_close($curl);
The function header() didn't work, it always dispalyed binary data. Maybe because I used these codes in the middle of webpage what has existed. The webpage outputed some texts before header(), so it didn't work.
I want to get image by url, and display image directly, no need save file to disc. So how can I do ? Please help me !!!
Aucun commentaire:
Enregistrer un commentaire