php - Http response header and body not correct as expected -
i working on proxy php. in php code sending proper required headers , expected response body , headers. getting response body correctly want not getting headers (supposed status 200 getting 401). when traced firefox found sap url itsself making 2 request internally using data send. first request not authenticated sap url itslef managining send same request again , 2nd time gives both proper response body headers. howevber php code when get response body 2nd response , headers 1st response. here code.
$opts = array( 'http'=>array( 'method'=>"post", 'content' => $xml_request, 'header'=>array("host:" . $sap_url, "content-type: text/xml; charset=utf-8", $authstring,$xml_request) ) ); $context = stream_context_create($opts); $result = file_get_contents($sap_url, false, $context); $http_res_array = get_headers($sap_url);
you should use curl functions instead , both requests yourself. file_get_contents, second request you, takes away possibility fetch second headers.
Comments
Post a Comment