<?php
$login_url = 'http://....81.118:7777/pls/wwwxk/xk.login';
$post_fields['stuid'] = '××××<span style="font-family: Arial, Helvetica, sans-serif;">';</span>
$post_fields['pwd'] = '<span style="font-family: Arial, Helvetica, sans-serif;">××××</span>';
//cookie文件存放在网站根目录的temp文件夹下
$cookie_file = tempnam('./temp','c12kie');
$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);
$gerenxinxi = curl_exec($ch);
curl_close($ch);
$send_url='http://....81.118:7777/pls/wwwxk/xk.CourseView';
$ch = curl_init($send_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
echo $contents = curl_exec($ch);
curl_close($ch);
?>