WAP手机版
保存到桌面加入收藏设为首页

首页 > 编程技术

PHP如何发送post get代码教程

2019-11-04 21:08:12 ColdOx 0人评论

方法1:

<?php

$url='http://www.lenniu.com/?a=1$b=2';

$html = file_get_contents($url); 

echo $html

?>


方法2:

<?php

$data = array ('foo' => 'bar');
$data = http_build_query($data);
$opts = array (
‘http' => array (
'method' => 'POST',
'header'=> "Content-type: application/x-www-form-urlencodedrn",
"Content-Length: " . strlen($data) . "rn",
'content' => $data
)
);
$context = stream_context_create($opts);
$html = file_get_contents('http://www.lenniu.com', false, $context);
echo $html;
?>


标签:如何  代码  发送  教程  

相关评论

0

Copyright © 2015-2019 10004820@qq.com 

  豫ICP备19024380号