I want to send a GET request to an external site, but also want to send some parameters
for example i've to send a get request to example.com
i want to execute www.example.com/send.php?uid=1&pwd=2&msg=3&phone=3&provider=xyz
My code is :
$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);
I get a server error .
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…