php 的curl只发送一次数据
$url="#";$requestString='wlanuserip=#';$getName=doCurlPostRequest($url,$requestString...
$url = "#";$requestString ='wlanuserip=#';$getName = doCurlPostRequest($url, $requestString, $timeout = 5,$server_ip);$getName=getArray($getName);$requestString="uuid=".urlencode($getName ->Redirect-> Uuid)."&userip=#&username=".urlencode($_POST["user"])."&password=".urlencode($_POST["password"])."&ratingtype=1";$loggin = doCurlPostRequest($url, $requestString, $timeout = 5,$server_ip);$loggin = getArray($loggin);使用wireshark查看发送的数据只有第一次怕post的数值,第二次loggin的post完全没有手动隐去了部分地址数据插入的函数function doCurlPostRequest($url, $requestString, $timeout = 10,$server_ip){ if ($url == '' || $requestString == '' || $timeout <= 0) return false; $con = curl_init((string)$url); $headers = array(); // $headers[] = 'Cache-Control: 25'; $headers[] = 'Content-Type: application/x-www-form-urlencoded'; $headers[] = 'User-Agent: #'; $headers[] = 'Expect: 100-continue'; $headers[] = 'Host: #'; // $headers[] = 'Connection: Keep-Alive'; $headers[] ='Content-Length: 150'; curl_setopt($con, CURLOPT_HTTPHEADER, $headers); curl_setopt($con, CURLOPT_HEADER, false); curl_setopt($con, CURLOPT_POSTFIELDS, $requestString); curl_setopt($con, CURLOPT_POST, true); curl_setopt($con, CURLOPT_RETURNTRANSFER, true); // curl_setopt($con, CURLOPT_REFERER,$server_ip); //curl_setopt($con, CURLOPT_FOLLOWLOCATION, false);// baidu test use curl_setopt($con, CURLOPT_TIMEOUT, (int)$timeout); $concet=curl_exec($con); curl_close($con); return $concet;}; function getArray($values) { libxml_disable_entity_loader(true); $values = simplexml_load_string($values, 'SimpleXMLElement', LIBXML_NOCDATA); $values = json_decode(json_encode($values, true)); return $values; };
第一张图是本来应该有的数据,第二张图是这个php上传的数据,求解 展开
第一张图是本来应该有的数据,第二张图是这个php上传的数据,求解 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询