【发布时间】:2011-11-13 05:57:31
【问题描述】:
我想向外部站点发送 GET 请求,但也想发送一些参数
例如,我必须向 example.com 发送 get 请求
我想执行 www.example.com/send.php?uid=1&pwd=2&msg=3&phone=3&provider=xyz
我的代码是:
$getdata = http_build_query(
array(
'uid' => '1',
'pwd' => '2',
'msg'=>'3',
'phone'=>'9999',
'provider'=>'xyz'
)
);
$opts = array('http' =>
array(
'method' => 'GET',
'content' => $getdata
)
);
$context = stream_context_create($opts);
$result = file_get_contents('http://example.com/send.php', false, $context);
我收到服务器错误。
【问题讨论】:
-
服务器错误说什么?
标签: php http get file-get-contents