1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Take a screenshot with curl

Discussion in 'PHP & Perl' started by zozor, Apr 11, 2009.

  1. zozor

    zozor Junior Member

    Joined:
    Dec 24, 2008
    Messages:
    113
    Likes Received:
    70
    Hi,
    Im creating a curl script which first login to a website and then submit a complicated form. Its is very hard to debug as I cannot see what was the error when It don't work.
    Is there a way to print or take a screenshot of the result of my curl script so I can see the errors ?
    Hope I was clear
    Thanks,
    David
     
  2. quaffapint

    quaffapint Newbie

    Joined:
    May 2, 2007
    Messages:
    25
    Likes Received:
    3
    Could you not simply look at the result of the curl_exec or the curl_errno?
     
  3. zappak

    zappak Junior Member

    Joined:
    Mar 8, 2007
    Messages:
    101
    Likes Received:
    9
    or can't you see whats wrong in return data.
    May be you should first use firefox's tamper addon to know what exactly things are being passed to that form before trying curl and then put same fields on curl.
     
  4. drdankmendez

    drdankmendez Junior Member

    Joined:
    May 30, 2008
    Messages:
    194
    Likes Received:
    316
    Location:
    In front of my computer
    you can print_r() the results of curl_exec. Also a plugin for Firefox could help. Firebug addon for Firefox is a pretty amazing tool. I recommend it to all programmers.

    If you are still having trouble, I wouldn't mind taking a look at the script. Just send me a PM
     
  5. harrisunderwork

    harrisunderwork BANNED BANNED

    Joined:
    Jan 20, 2009
    Messages:
    52
    Likes Received:
    4
    Echo the curl_exec
     
  6. 00CivicEX

    00CivicEX Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 3, 2009
    Messages:
    293
    Likes Received:
    214
    use this, of course adjust the $html to your needs

    Code:
    $html= curl_exec($ch);
    if (!$html) {
     echo "<br />cURL error number:" .curl_errno($ch);
     echo "<br />cURL error:" . curl_error($ch);
     exit;
    }
     
  7. Balrog

    Balrog Newbie Premium Member

    Joined:
    Nov 23, 2007
    Messages:
    14
    Likes Received:
    2
    Occupation:
    Programmer
    Location:
    Poland
    You can always use SELENIUM IDE for such tests