Skip to content

Instantly share code, notes, and snippets.

@kylexlau
Created August 13, 2009 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylexlau/166912 to your computer and use it in GitHub Desktop.
Save kylexlau/166912 to your computer and use it in GitHub Desktop.
job168.com auto login
<?php
// Auto login to job168.com and refresh resume.
$username="kylexlau";
$password="******";
$jcookie="./jcookie";
$ch = curl_init();
$option = array(
CURLOPT_URL => 'http://www.job168.com/person/logon.jsp',
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6",
CURLOPT_POSTFIELDS => "account=$username&password=$password",
CURLOPT_POST => 1,
CURLOPT_TIMEOUT => 60,
CURLOPT_SSL_VERIFYPEER => FALSE,
// CURLOPT_FOLLOWLOCATION => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_COOKIEJAR => $jcookie,
CURLOPT_COOKIEFILE => $jcookie,
// CURLOPT_COOKIESESSION => TRUE,
// CURLOPT_COOKIE => "session_name() . '=' . session_id()",
CURLOPT_REFERER => 'http:/www.job168.com/'
);
curl_setopt_array($ch, $option);
$result = curl_exec ($ch);
echo $result;
curl_close($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.job168.com/person/updatetime.jsp?pid=77138983');
curl_setopt($ch, CURLOPT_COOKIEFILE, $jcookie);
$result2 = curl_exec($ch);
echo $result2;
#unlink($jcookie);
exit;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment