Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Create temp file to store cookies
- $ckfile = tempnam ("/tmp", "CURLCOOKIE");
- // URL to login page
- $url = "https://www.mercadolivre.com/jms/mlb/lgz/login/authenticate";
- // Get Login page and its cookies and save cookies in the temp file
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Accepts all CAs
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_COOKIEJAR, $ckfile); // Stores cookies in the temp file
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $output = curl_exec($ch);
- echo '1<BR></BR>' . $output;
- // Post login form and follow redirects
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Accepts all CAs
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_POST, count($fields));
- curl_setopt($ch, CURLOPT_POSTFIELDS, 'user_id=XXX&password=XXX&remember_me=true&signInButton=Entrar&callback_error=https://www.mercadolivre.com/jms/mlb/lgz/login&go=http://www.mercadolivre.com.br&platform_id=ml&site_idmlb&loginType=DEFAULT&dps=54d6e5ade4b0618bdcd983d0&parent_url=&arfRedirUrl=');
- curl_setopt($ch, CURLOPT_COOKIEFILE, $ckfile); //Uses cookies from the temp file
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Tells cURL to follow redirects
- $output = curl_exec($ch);
- echo '2<BR></BR>' . $output;
- $url = "http://www.mercadolivre.com.br";
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Accepts all CAs
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_COOKIEFILE, $ckfile); //Uses cookies from the temp file
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $output = curl_exec($ch);
- echo '3<BR></BR>' . $output;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment