我正在传递这个 URL
"url=http://localhost.com/tenHsServer/tenHsServer.aspx?t=ab&f=DeviceStatus&d=C5"
进入这个 php 文件
<?php
//set POST variables
$url = $_POST['url'];
unset($_POST['url']);
$fields_string = "";
//url-ify the data for the POST
foreach($_POST as $key=>$value) {
$fields_string .= $key.'='.$value.'&';
}
$fields_string = rtrim($fields_string,'&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($_POST));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
?>
出于某种原因,它说未知功能 f,但是当我手动将其粘贴到浏览器中时,它工作得很好?