How to get a generated captcha image from a remote url ?

Discussion in 'PHP' started by erwinol, Mar 16, 2011.

  1. #1
    Hi everybody !

    I am working on a project for a customer and I need the get a captcha image from a remote URL. The problem is the image is generated with PHP (GD library) and placed with Javascript (jQuery).

    The problem is not to solve it (I succeeded) but simply to get the image url.

    Example : http://www.rechercher.fr/webmaster-login.html

    You can see in the source :
    <div class="infos captchaCode"></div>
    HTML:
    And the javascript handling this :
    http://www.rechercher.fr/javascript/jquery/jquery.captchaCode.js

    If I turn on the HTTP Live Headers extension of FireFox, I can see the image url :
    
    http://www.rechercher.fr/captcha/png/Y8SECM1N2WGKILZ7UARW
    
    GET /captcha/png/Y8SECM1N2WGKILZ7UARW HTTP/1.1
    Host: www.rechercher.fr
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; fr; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15
    Accept: image/png,image/*;q=0.8,*/*;q=0.5
    Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 115
    Connection: keep-alive
    Cookie: 90plan=R4114020273; PHPSESSID=1d867b5efbd6680f97b4979cb210b8c3
    
    Code (markup):
    Unfortunatelly, cURL and wget cannot help me with that because they only get the general HTTP Header. They are not interpreters and cannot get the images elements.

    I don't want to tell my customer that I spent a full day to make the function to solve the captcha but that it is useless because i cannot even get the image to solve. I would look ridiculous ^^

    Does anyone have an idea ?
    Even a small lead would be very welcome.

    Thank you.
     
    erwinol, Mar 16, 2011 IP
  2. awood969

    awood969 Member

    Messages:
    186
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    40
    #2
    The whole point of CAPTCHA is that is cannot be machine read at all. GD dynamically creates an image from code and stores it in memory on the server for that page load. Once the apache session moves on it is removed from scope. On quick glance I don't think you can read this, thats meant to be the point.

    My only suggestion to you is to take a look at the GD function library on PHP's website for a greater insight and understanding into how PHP generates the image and see if you can figure out a way around it. I would be interested to know if this can be acomplished.

    Andrew
     
    awood969, Mar 16, 2011 IP