I would like to download an image that is hotlink protected. How can I forge the HTTP header with CURL to say the referer is coming from its own server?
I have tried with this command but it fails. I'm not familiar with PHP and help would be much apreciated.
Option looks to be
with
, or
but not sure about the correct syntax.
<hr>
EDIT 2 :
I got an error saying that curl_setopt() expects parameter 2 to be long. After removing the MUTE option the error is gone.
To show the image I have tried this code but the page remains blank.
<hr>
EDIT 1:
The code I have entered in my Wordpress post (I use the plugin <a href="http://www.willmaster.com/software/WPplugins/insert-php-wordpress-plugin-instructions.php" rel="nofollow">Insert PHP</a>)
The error I have when I load the page :
I have tried with this command but it fails. I'm not familiar with PHP and help would be much apreciated.
Code:
curl -A "Mozilla/5.0" -L -b /tmp/c -c /tmp/c -s 'http://remote-site.com/image.jpg' > image.jpg
Option looks to be
Code:
CURLOPT_REFERER
Code:
curl_setopt
Code:
curl --referer
<hr>
EDIT 2 :
I got an error saying that curl_setopt() expects parameter 2 to be long. After removing the MUTE option the error is gone.
To show the image I have tried this code but the page remains blank.
Code:
$image = curl_exec($ch);
curl_close($ch);
fclose($fp);
print '<img src="'.$image.'"/>';
<hr>
EDIT 1:
The code I have entered in my Wordpress post (I use the plugin <a href="http://www.willmaster.com/software/WPplugins/insert-php-wordpress-plugin-instructions.php" rel="nofollow">Insert PHP</a>)
Code:
[insert_php]
curl --referer http://www.DOMAIN.com/ -A "Mozilla/5.0" -L -b /tmp -c /tmp -s 'http://www.DOMAIN.com/image.png' > image.png
[/insert_php]
The error I have when I load the page :
Code:
Parse error: syntax error, unexpected ‘<‘ in /public_html/wp-content/plugins/insert-php/insert_php.php(48) : eval()’d code on line 8