PHP gets Cookie analog login

time:15-04-08 forum:PHP tools and code
  http://www.cnblogs.com/txw1958/p/php-cookie-login.html
Author: square room

1. Define Cookie storage path / > you must use absolute path. Dirname (__FILE__)..quot; /pic.cookie.quot; [/code]


two, Cookie

Save cookie
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie_jar);
$content = curl_exec ($ch). To the server, let the server think that the browser opens the landing page

[code]$ch = curl_init ();
curl_setopt ($ch, CURLOPT_URL,'http://1.2.3.4/getCheckpic.action? Rand=6836.185874812305');
curl_setopt. />curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$ret = curl_exec ($ch);
curl_close ($ch);
[/code]
[/code] four. >$ch = curl_init ();
curl_setopt ($ch, CURLOPT_URL,.Quot; http://1.2.3.4/loginstudent.action.quot;);
curl_setopt.
$result=curl_exec ($ch);
curl_close ($ch);
[/code]

five, to the specified page to obtain data
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie_jar);

prev:PHP curl function to simulate crawler (o... next:Ji'nan non heritage park ticket pricing ...
post comment
Notice



approved   Returnees in mountainous areas suppo...   Where is the old Ji'nan? More than 3...   A small set of fingers can adjust th...   In the mountains, after 80 years hai...   The General Administration of food a...
rand   PHP encryption and decryption thunde...   PHP removes the tail space and decim...   Simple text filtering function of PH...   [ASP] [PHP] set up as a desktop shor...   PHP Chinese character conversion fun...
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com