re-call cookies curl php -


hello want know how can re-call facebook cookie. created curl in php generate cookies using code , save cookie text file directory. want know how can re-call cookie file directory use again.

function get_login($em,$pa,$cookie,$ipku){ $ip = array("remote_addr: $ipku", "http_x_forwarded_for: $ipku"); $ch = curl_init(); curl_setopt($ch, curlopt_url, 'https://www.facebook.com/login.php'); curl_setopt($ch, curlopt_postfields,'email='.urlencode($em).'&pass='.urlencode($pa).'&login=login'); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_followlocation, 1); curl_setopt($ch,curlopt_httpheader,$ip); curl_setopt($ch, curlopt_cookiejar,$cookie); curl_setopt($ch, curlopt_cookiefile,$cookie); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_useragent,'opera/9.80 (series 60; opera mini/6.5.27309/34.1445; u; en) presto/2.8.119 version/11.10'); curl_setopt($ch, curlopt_referer,  "https://www.facebook.com");  $body = curl_exec($ch) or die(curl_error   ($ch));  } 

$ch = curl_init(); curl_setopt($ch, curlopt_url, $url);  curl_setopt($ch, curlopt_header, 1);  curl_setopt($ch, curlopt_returntransfer, true);  $content = curl_exec($ch);  curl_close($ch);  list($header, $body) = explode("\r\n\r\n", $content);  // find out cookies preg_match("/set\-cookie:([^\r\n]*)/i", $header, $matches);  // put cookies subsequent request // curl_setopt($ch, curlopt_cookie, $cookie); $cookie = $matches[1]; 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -