PHP cURL script that can log in to Pinterest

Discussion in 'PHP' started by ssimon171078, Mar 13, 2015.

  1. #1
    i wrote some php script that need to log into Pinterest but fails to log in:
    can you help to fix it ?

    <?php
    $login_email = 'user';
    $login_pass = pass';
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://www.pinterest.com/login/');
    curl_setopt($ch, CURLOPT_POSTFIELDS,'email='.urlencode($login_email).'&pass='.urlencode($login_pass));
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
    curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
    curl_setopt($ch, CURLOPT_REFERER, "https://www.pinterest.com/");
    curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ;
    curl_setopt($curl, CURLOPT_USERPWD, "admin171078@gmail.com:simon171078");
    $page = curl_exec($ch);
    
    $output=@curl_exec($ch);
    $info = @curl_getinfo($ch);
    
    echo $output;
    print_r($info);
    ?>
    PHP:

     
    ssimon171078, Mar 13, 2015 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    It would help if you provided the actual code
     
    PoPSiCLe, Mar 13, 2015 IP
  3. Imgup

    Imgup Member

    Messages:
    67
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    43
    #3
    As PoPSiCLe said, it would help to see some code. If not, checkout this thread on Stackoverflow: http://stackoverflow.com/questions/23568948/pinterest-login-with-php-and-curl-not-working
     
    Imgup, Mar 13, 2015 IP
  4. ssimon171078

    ssimon171078 Well-Known Member

    Messages:
    277
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #4
    $login_email = 'user';
    $login_pass = pass';

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'website/login/');
    curl_setopt($ch, CURLOPT_POSTFIELDS,'email='.urlencode($login_email).'&pass='.urlencode($login_pass));
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
    curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
    curl_setopt($ch, CURLOPT_REFERER, "website");
    curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ;
    curl_setopt($curl, CURLOPT_USERPWD, "user:pass");
    $page = curl_exec($ch);

    $output=@curl_exec($ch);
     
    ssimon171078, Mar 13, 2015 IP
  5. Imgup

    Imgup Member

    Messages:
    67
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    43
    #5
    Yeah, see, you've done the same as the guy on the Stackoverflow thread. http://stackoverflow.com/questions/23568948/pinterest-login-with-php-and-curl-not-working

    That thread has a working example.
     
    Imgup, Mar 13, 2015 IP
  6. usermaster

    usermaster Well-Known Member

    Messages:
    345
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    128
    #6
    anyone was able to fix it?
     
    usermaster, Feb 23, 2017 IP