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

Problems with PHP & cURL

Discussion in 'PHP & Perl' started by Adrian11111, Jan 7, 2012.

  1. Adrian11111

    Adrian11111 Newbie

    Joined:
    Jan 7, 2012
    Messages:
    1
    Likes Received:
    0
    Hello,
    I am trying to build a script wich will log in automatically at this page: ( see the linkat the Edit Reason please)

    The problem is that because of all js and stuff from there i can't get it working.

    Anyone have any ideeas and suggestions?

    PHP:
    <?php
    $ch 
    curl_init();
    curl_setopt($chCURLOPT_URL'{LINK FROM THE EDIT REASON}');
    curl_setopt ($chCURLOPT_POST1);

    //The value scrapped loc1
    $password "";
    $email "";
    //Load the page and get the values here?

    curl_setopt ($chCURLOPT_POSTFIELDS'__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE='.$value_scraped1.'&__PREVIOUSPAGE='.$val2.'&__EVENTVALIDATION='.$val3.'&ctl00%24hfUILocale=en_US&ctl00%24txtProductSearchName=Product+Search&ctl00%24cpContent%24txtUserName='.$email.'&ctl00%24cpContent%24txtPassword='.$password.'&ctl00%24cpContent%24btnSignIn=Sign+In');
    curl_setopt ($chCURLOPT_COOKIEJAR'cookie.txt');
    curl_setopt ($chCURLOPT_RETURNTRANSFER1);


    $store curl_exec ($ch);
    curl_setopt($chCURLOPT_URL'{YOUR ACCOUNT LINK}');


    $content curl_exec ($ch);
    echo 
    $content;
    curl_close ($ch); 

    ?>
    This is what i have writed but it just do nothing.
     
    Last edited: Jan 7, 2012
  2. chevet

    chevet Jr. VIP Jr. VIP

    Joined:
    Jun 23, 2010
    Messages:
    101
    Likes Received:
    30
    1. Use Firefox addon Live HTTP header - you will see data send to the server when submiting form
    2. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); - could help
    3. https:// address - google "curl SLL"
    4. google "show curl error" - u will see more than nothing
    5. almost always its good to set:
    curl_setopt($ch, CURLOPT_REFERER, $reffer);
    curl_setopt($ch, CURLOPT_USERAGENT, $agent);

    $agent e.i. = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";