How to retrieve an image from web generated from a php script

255 Views Asked by At

Basically I want to programmatically retrieve an image (captcha) generated by a PHP script from the projecteuler.net site, for automation purpose.

enter image description here

How can I do that?

Here is the code from the html source

<img src="captcha/show_captcha.php" id="captcha_image" onclick="javascript:this.src='captcha/show_captcha.php?'+Math.random();" style="border:1px solid #999;" /><br />Click image for new code
1

There are 1 best solutions below

0
On BEST ANSWER

Assuming you want to do it programmatically in PHP: Use a simple web spider tool (e.g. http://www.sphider.eu/) or any other method to access the DOM and fetch the image that way. Here is a post that offers a solution that might fit your bill: https://www.daniweb.com/web-development/php/threads/340460/php-image-crawlerspider