function http_open($url, $data, $cookie = null, $method = get, $timeout = 60) {
$options = array();
$options['http']['method'] = $method;
$options['http']['user_agent'] = $_server['http_user_agent'];
$options['http']['timeout'] = $timeout;
if($method == post) :
$length = strlen($data);
$options['http']['header'] = content-type: application/x-www-form-urlencoded\r\n.
content-length: {$length}\r\n.
p3p: cp=\cura adma deva psao psdo our bus uni pur int dem sta pre com nav otc noi dsp cor\\r\n.
cookie: {$cookie}\r\n.
connection: close\r\n;
$options['http']['content'] = $data;
else:
$options['http']['header'] = content-type: application/x-www-form-urlencoded\r\n.
p3p: cp=\cura adma deva psao psdo our bus uni pur int dem sta pre com nav otc noi dsp cor\\r\n.
cookie: {$cookie}\r\n.
connection: close\r\n;
endif;
$context = stream_context_create($options);
return file_get_contents($url, 0, $context);
}
echo http_open(http://localhost/1.php, username=haowei, id=5, post);
http://www.bkjia.com/phpjc/825244.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/825244.htmltecharticle复制代码 代码如下: ?php function http_open($url, $data, $cookie = null, $method = get, $timeout = 60) { $options = array(); $options['http']['method'] = $method; $options...
