标题: 有酬谢,支付宝~求大神,怎么获取重定向过的页面源码?
时间: 2013-11-22
『回复列表(10|隐藏机器人聊天)』
<?php
function do_post_request($url, $data, $optional_headers = null)
{
$params = array('http' => array(
'method' => 'POST',
'content' => $data
));
if ($optional_headers !== null) {
$params['http']['header'] = $optional_headers;
}
$ctx = stream_context_create($params);
$fp = @fopen($url, 'rb', false, $ctx);
if (!$fp) {
throw new Exception("Problem with $url, $php_errormsg");
}
$response = @stream_get_contents($fp);
if ($response === false) {
throw new Exception("Problem reading data from $url, $php_errormsg");
}
return $response;
}
$a= do_post_request("http://www.ylsyzx.net/seek.asp?action=seek","bb=班别号&ks=考试类别");
echo $a;
?>