PHP uses curl to simulate a simple instance of everyone (on-campus) network
$login _url = ' http://passport.renren.com/PLogin.do ';
$post _fields[' email '] = ' XXXX ';
$post _fields[' password '] = ' XXXX ';
$post _fields[' origurl '] = ' http%3a%2f%2fhome.renren.com%2fhome.do ';
$post _fields[' domain '] = ' renren.com ';
The cookie file is stored under the Temp folder in the root directory of the Web site $cookie _file = Tempnam ('./temp ', ' Cookie ');
$ch = Curl_init ($login _url); curl_setopt ($ch, Curlopt_useragent, ' mozilla/5.0 (Windows; U Windows NT 5.1; ZH-CN;
rv:1.9.1.5) gecko/20091102 firefox/3.5.5 ');
curl_setopt ($ch, Curlopt_header, 0);
curl_setopt ($ch, Curlopt_returntransfer, 1);
curl_setopt ($ch, Curlopt_maxredirs, 1);
curl_setopt ($ch, curlopt_followlocation, 1);
curl_setopt ($ch, Curlopt_autoreferer, 1);
curl_setopt ($ch, Curlopt_post, 1);
curl_setopt ($ch, Curlopt_postfields, $post _fields);
curl_setopt ($ch, Curlopt_cookiejar, $cookie _file);
Curl_exec ($ch);
Curl_close ($ch);
With cookies file, access to Renren home $send _url= ' http://home.renren.com/Home.do ';
$ch = Curl_init ($send _url); Curl_setopT ($ch, Curlopt_header, 0);
curl_setopt ($ch, Curlopt_returntransfer, 1);
curl_setopt ($ch, Curlopt_cookiefile, $cookie _file);
$contents = curl_exec ($ch);
Curl_close ($ch);
Clean cookie file unlink ($cookie _file);
Output the content of the home page of Renren Print_r ($contents);
Above this PHP use Curl Analog login Everyone (Campus) network Simple example is small series to share all the content, hope to give you a reference, also hope that we support cloud habitat community.