Posts Tagged “curl”

Sometimes it becomes necassary to test a link from a particular referrer. This is easily done with the following curl statement:

curl -I -H “Referer: http://your_referrer_here”

The ‘-I’ is used to display header information and the ‘-H’ is used to specify other header information. Lets take a look at the header information of a normal curl:

[ ~]$ curl -I
HTTP/1.1 200 OK
Date: Mon, 03 Jan 2011 14:17:13 GMT
Server: Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/ PHP/5.2.12
Last-Modified: Mon, 18 May 2009 06:30:44 GMT
ETag: “40003d-1060c-46a29ef124d00″
Accept-Ranges: bytes
Content-Length: 67084
Content-Type: image/jpeg

As you can see, this is returning an image file as it should. Now lets specify a referrer (basically making it look like some other website is hotlinking their image).

[ ~]$ curl -I -H “Referer:”