Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

CURL Image, based on url (gif/png/jpg)

Can someone here give me a script that curl's image from another domain.

If the get request is PNG, then it outputs it as PNG header.. If it's JPG, it outputs it as JPG Header...

It only has to work with images, with extensions png/gif/jpg

PHP Code

<?php 
$ch 
= curl_init ("http://www.google.com/images/logos/ps_logo2.png");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
$image = curl_exec($ch);
curl_close ($ch);
header("Content-Type: image/png");
echo 
$image;
?>
^ Example this would echo image/png automaticly as the url is png header.. it wouldnt accept php files, html or output anything but images ? lol


Possibly Related Threads...
Thread / Author Replies Views Last Post
by a_different_usernameJan 7, 2019 12:27 PM 0 165 Jan 7, 2019 12:27 PM
Last Post: a_different_username
by James BurnhamDec 7, 2018 12:23 PM 2 181 Dec 7, 2018 12:23 PM
Last Post: James Burnham
by patrykqJun 18, 2018 05:16 AM 11 344 Jun 18, 2018 05:16 AM
Last Post: Eagle 95