url or content as a variable in the header of the page

Posted by Scorpion King on Stack Overflow See other posts from Stack Overflow or by Scorpion King
Published on 2010-12-21T05:44:07Z Indexed on 2010/12/21 5:54 UTC
Read the original article Hit count: 229

Filed under:
|
|

I am designing a site where external links form various are being shown on my page. I am using

$url=$_GET['url'];
$website_data = file_get_contents($url);
echo $website_data;

so essentially a user would click on a hyperlink which is something like www.test.com/display_page.php?url=http://www.xyz.com/article/2.jpg

My page, list_of_images.php, typically has a list of images with href for each image as above on the page and when any image is clicked it would go to display_page.php, which would show our banner on the top of this page, some text and then this image beneath that. This image could be from any website.

I am currently sending the url directly and grabbing it using GET. I understand that users/hackers can actually do some coding and send commands for the url variable and could break the server or do something harmful and so i would like to avoid this method or sending the url directly in the header. what is the alternate approach for this problem?

© Stack Overflow or respective owner

Related posts about php

Related posts about image