You're encountering issues logging in to Barnesandnoble.com's mobile site using Curl with SSL and cookies. Despite having a working code for eBay, the login fails specifically on Barnesandnoble.com, which uses HTTPS.
The original code had two potential problems:
The revised code below addresses these issues:
// ... Your previous code ... // URLEncode POST parameters $fields['emailAddress'] = urlencode($EMAIL); $fields['acctPassword'] = urlencode($PASSWORD); // Get x value from initial page $x = ''; if (preg_match('/op\.asp\?x=(\d+)/i', $content, $match)) { $x = $match[1]; } // Set login URL with x parameter $LOGINURL = "https://cart2.barnesandnoble.com/mobileacct/op.asp?x=$x"; // ... Your previous code ...
This updated code successfully logs in to Barnesandnoble.com. Once you have obtained the cookies, you can create subsequent Curl objects using the same COOKIEFILE and COOKIEJAR options to maintain the logged-in state without additional authentication.
The above is the detailed content of Why is my Curl login to Barnesandnoble.com failing with SSL and cookies?. For more information, please follow other related articles on the PHP Chinese website!