0
<?php
@$test = $GET['link'];
$url = 'http://cf3.fancyimgs.com/310/20130521/367302239598940361_92b5e3190b3f.jpg';
$ch = curl_init($test);
$fc = fopen('c.jpg', 'w+');
curl_setopt($ch, CURLOPT_FILE, $fc);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fc);
?>

this is not working in codeigniter, above is my php code to get image from an url that i passed through GET and am not getting the image from the get request url can anyone help me to solve this..... and below is the link from where i send the image url

<a href="index.php?link=<?php echo $url ;?>">click to download</a>

1 Answer 1

3

It should be

$_GET['link']
 ^
 |--- Note the underline 

Not

$GET['link']

And

echo urlencode($url) // would be better approach ... 
Sign up to request clarification or add additional context in comments.

1 Comment

+1 for the approach to point out the error. One of the best way i have seen until now to highlight the error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.