Created
December 20, 2010 17:05
-
-
Save SathyaBhat/748648 to your computer and use it in GitHub Desktop.
Stupid php code to fetch images from remote server & serve it to you.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stupid php code to fetch images from remote server & serve it to you. Takes single image URL only. | |
# Replaces prior images. No caching. Horribly n00bish. Don't flame me, written with no php knowledge | |
index.php: | |
--- | |
<HTML> | |
<HEAD> | |
<TITLE>Image Grabber </TITLE> | |
</HEAD> | |
<BODY> | |
<FORM method="post" ACTION="fetch_images.php"> | |
URL: <input type=text name="ImgUrl" size="80"> | |
<INPUT TYPE=SUBMIT /> | |
</BODY> | |
</HTML> | |
fetch_images.php | |
----- | |
<?php | |
$imgurl = $_REQUEST['ImgUrl']; | |
echo 'Requested image: '; echo $imgurl; | |
echo '<br />'; | |
echo 'Fetch another <a href="http://your-domain/">image</a>?<br/>'; | |
$img = 'img.png'; | |
file_put_contents($img, file_get_contents($imgurl)); | |
?> | |
<img src ="img.png" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment