1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Problems with PHP & cURL

Discussion in 'PHP' started by Adrian111, Jan 6, 2012.

  1. #1
    Adrian111, Jan 6, 2012 IP
  2. zappak

    zappak Active Member

    Messages:
    366
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    80
    #2
    I"m not too much sure about but may be you can try this..

    1. get that page and scrape some value of variable from source and post back to page.. post data is given bellow..

    2. $post = '__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE='.$value_scraped1.'&__PREVIOUSPAGE='.val.'&__EVENTVALIDATION='.$value_scraped3.'&ctl00%24hfUILocale=en_US&ctl00%24txtProductSearchName=Product+Search&ctl00%24cpContent%24txtUserName='.$email.'&ctl00%24cpContent%24txtPassword='.$password.'&ctl00%24cpContent%24btnSignIn=Sign+In';

    :))
     
    zappak, Jan 6, 2012 IP
    Adrian111 likes this.
  3. Adrian111

    Adrian111 Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks.

    <?php
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://e5.onthehub.com/WebStore/Security/SignIn.aspx?ws=82fe585a-db9b-e011-969d-0030487d8897&vsro=8');
    curl_setopt ($ch, CURLOPT_POST, 1);
    
    //The value scrapped loc1
    $password = "";
    $email = "";
    //Load the page and get the values here?
    
    curl_setopt ($ch, CURLOPT_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 ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    
    
    $store = curl_exec ($ch);
    curl_setopt($ch, CURLOPT_URL, 'https://e5.onthehub.com/WebStore/Account/YourAccount.aspx?ws=82fe585a-db9b-e011-969d-0030487d8897&vsro=8');
    
    
    $content = curl_exec ($ch);
    echo $content;
    curl_close ($ch); 
    
    ?>
    PHP:
    Should I scratch the value at the moment specificated on the comment, by having the page already loaded there?
    At this moment the code dont't do ahyhing, it just show me again the login page with no values in the fields.
     
    Adrian111, Jan 6, 2012 IP
  4. Adrian111

    Adrian111 Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Anyone ?
    Thanks.
     
    Adrian111, Jan 6, 2012 IP
  5. zappak

    zappak Active Member

    Messages:
    366
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    80
    #5
    no..

    first load page into variable and scraped value which i've mentioned then again post value with url.. after close curl

    got?
     
    zappak, Jan 8, 2012 IP
  6. Adrian111

    Adrian111 Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Yes got it working, thanks.
     
    Adrian111, Jan 8, 2012 IP