Reputation: 23
<?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>
Upvotes: 0
Views: 306
Reputation: 95161
It should be
$_GET['link']
^
|--- Note the underline
Not
$GET['link']
And
echo urlencode($url) // would be better approach ...
Upvotes: 3