Pinterest login with PHP and cURL not working

0 votes

I've been trying to use cURL to get into pinterest.com for the past 17 hours without success. I've tried countless and endless different approaches using only cURL.

My existing code simply brings me to the login page; it does not log in because the data is not uploaded.

The first code sends me to the login screen using USERPWD, but it doesn't log me in.

error_reporting(E_ALL); 
ini_set("display_errors", 1); 

$url = "https://www.pinterest.com/login/";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // allow https verification if true
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // check common name and verify with host name
curl_setopt($ch, CURLOPT_SSLVERSION,3); // 
curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "pin.pem"); // allow ssl cert direct comparison
curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE); // set new cookie session
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
curl_setopt($ch, CURLOPT_USERPWD, "email:password");

curl_setopt($ch, CURLOPT_SSLVERSION,3);

// grab URL and pass it to the browser
curl_exec($ch);

// close cURL connection, save cookie file, free up system resources
curl_close($ch);

And if I switch it from CURLOPT_USERPWD to,

curl_setopt($ch, CURLOPT_POSTFIELDS, 'username_or_email=$email&password=$password');

It just displays a blank page.

The pin.pem is the X.509 Certificate (PEM) file. Can someone please help me with this?

Aug 5, 2022 in PHP by Kithuzzz
• 38,010 points
1,436 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In PHP

0 votes
0 answers

mysql not working with php

 I'm using Apache2, php5, and MySQL. Every time I try ...READ MORE

Jun 24, 2022 in PHP by narikkadan
• 63,420 points
260 views
0 votes
1 answer

Complete PHP form with proper validation and syntax

Hey @kartik, It's quite simple to have php ...READ MORE

answered Feb 19, 2020 in PHP by Niroj
• 82,880 points
1,273 views
0 votes
1 answer

How can I use Sockets.io on the client side and communicate with a PHP based application on the server?

Hello @kartik, For 'long-lived connection' , you can ...READ MORE

answered Aug 24, 2020 in PHP by Niroj
• 82,880 points
2,698 views
0 votes
1 answer

How can I select and upload multiple files with HTML and PHP using HTTP POST?

Hello @kartik, This is possible in HTML5. Example (PHP ...READ MORE

answered Sep 15, 2020 in PHP by Niroj
• 82,880 points
1,645 views
0 votes
1 answer

How to upload and Save Files with Desired name using php?

Hello, You can try this, $info = pathinfo($_FILES['userFile']['name']); $ext = ...READ MORE

answered Nov 4, 2020 in PHP by anonymous
• 82,880 points
9,009 views
0 votes
1 answer

How to save image from url with curl PHP?

Hello @kartik, try this: function grab_image($url,$saveto){ ...READ MORE

answered Nov 14, 2020 in PHP by Niroj
• 82,880 points
6,674 views
0 votes
2 answers

Using PHP to get all file names in a folder stored in HDFS

So i found a workaround for the ...READ MORE

answered Mar 13, 2019 in Big Data Hadoop by Bhavish
• 370 points

edited Mar 13, 2019 by Omkar 3,664 views
0 votes
0 answers

PHP, cURL, and HTTP POST example?

I needed t to send data like ...READ MORE

Jun 1, 2022 in PHP by Kichu
• 19,050 points
351 views
0 votes
0 answers

php extension mcrypt must be loaded

When I tried to install Magento on ...READ MORE

Jun 16, 2022 in PHP by narikkadan
• 63,420 points
279 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP