更改重定向PHP CURL中的内容

时间:2018-07-12 09:02:38

标签: php curl http-status-code-307

我正在连接到网络服务。第一个请求是带有登录凭证的SOAP内容。如果凭据正确,则使用新位置的307 Temp Redirection响应服务。但是,新位置需要不同的SOAP内容。下面的代码返回两个带有307200的标头。

    $login_xml = file_get_contents("login.xml");
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, "http://10.1.10.111:8001");
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "$login_xml");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);

    $response = curl_exec($ch);

如何更改重定向位置的请求内容?

谢谢

0 个答案:

没有答案