Marco Schuster <marco@...> writes:
Colm McMullan schrieb:
For example, how do i get from:
[[Image:Asperger kl2.jpg|thumb|[[Hans Asperger]] to http://upload.wikimedia.org/wikipedia/en/5/57/Asperger_kl2.jpg
Special:Filepath:/Asperger kl2.jpg is what you're searching for; it gives you an HTTP redirect with a Location: header. Apply the regexp preg_match("/Location: (.*)\r\n/i",$html,$return); to the HTTP headers, and you'll find in $return[1] the URI to the image.
Marco
Marco,
Thanks for getting back to me so quickly, but that doesn't seem to be working for me, am I using it incorrectly?
http://commons.wikimedia.org/w/index.php? \ title=Special%3AFilepath&file=Asperger+kl2.jpg
GET /w/index.php?title=Special%3AFilepath& \ file=Asperger+kl2.jpg HTTP/1.1 Host: commons.wikimedia.org .... Accept-Language: en,en-us;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://commons.wikimedia.org/w/index.php? \ title=Special%3AFilepath&file=Asperger+kl2.jpg
HTTP/1.x 404 Not Found Date: Thu, 07 Feb 2008 23:59:37 GMT Server: Apache X-Powered-By: PHP/5.1.4 Cache-Control: private, s-maxage=0, max-age=0, \ must-revalidate Content-Language: en Vary: Accept-Encoding,Cookie Expires: Thu, 01 Jan 1970 00:00:00 GMT Content-Encoding: gzip Content-Length: 3433 Content-Type: text/html; charset=utf-8 X-Cache: MISS from sq25.wikimedia.org, MISS from knsq2.knams.wikimedia.org, MISS from knsq4.knams.wikimedia.org X-Cache-Lookup: MISS from sq25.wikimedia.org:3128, MISS from knsq2.knams.wikimedia.org:3128, MISS from knsq4.knams.wikimedia.org:80 Via: 1.0 sq25.wikimedia.org:3128 (squid/2.6.STABLE18), 1.0 knsq2.knams.wikimedia.org:3128 (squid/2.6.STABLE18), 1.0 knsq4.knams.wikimedia.org:80 (squid/2.6.STABLE18) Connection: close