使用PHP发布到远程服务器,但收到404错误

使用PHP发布到远程服务器,但收到404错误,php,curl,Php,Curl,当我使用vardump将curl数据发布到一个php文件中时,会返回一个404错误或一个白色屏幕。但是如果我把同一个文件放在服务器上,服务器上也有curlpost文件,那么它就工作了。这是该职位的代码: <?php $imp = new DOMImplementation(); $xml_data = $imp->createDocument( null, 'cXML', $imp->createDocumentType('cXML',

当我使用vardump将curl数据发布到一个php文件中时,会返回一个404错误或一个白色屏幕。但是如果我把同一个文件放在服务器上,服务器上也有curlpost文件,那么它就工作了。这是该职位的代码:

<?php



$imp = new DOMImplementation();
$xml_data = $imp->createDocument(
    null, 
    'cXML',  
    $imp->createDocumentType('cXML', 
        null, 
        'http://xml.cXML.org/schemas/cXML/1.2.008/cXML.dtd'
    )
);
$xml_data->xmlVersion="1.0";
$xml_data->encoding="UTF-8";


$root = $xml_data->createElement("cXML");
$xml_data->appendChild($root);


$rootAttributePayload = $xml_data->createAttribute("payloadID");
$root->appendChild($rootAttributePayload);


    $cXMLOrder = $xml_data->saveXML();
            $cXMLOrder = htmlspecialchars($cXMLOrder, ENT_QUOTES);

            $data = array('cXML-urlencoded' => $cXMLOrder);

            $ch = curl_init();

            $return_url1 = 'http://www.thisisanexample.net/POST_TEST.php';
            curl_setopt($ch, CURLOPT_URL, $return_url1);
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt( $ch, CURLOPT_POSTFIELDS,   $data);
            // receive server response ...
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);



            curl_setopt($ch, CURLOPT_VERBOSE, true);

            $verbose = fopen('php://temp', 'w+');
            curl_setopt($ch, CURLOPT_STDERR, $verbose);

            $result = curl_exec($ch);
if ($result === FALSE) {
    printf("cUrl error (#%d): %s<br>\n", curl_errno($ch),
           htmlspecialchars(curl_error($ch)));
}

rewind($verbose);
$verboseLog = stream_get_contents($verbose);

echo "Verbose information:\n<pre>", htmlspecialchars($verboseLog), "</pre>\n";
            curl_close ($ch);

            // further processing ....
            if ($server_output == "OK") {echo "worked"; } else { echo "error"; }




?>

以下是调试信息:

在DNS缓存中找到主机名 *DNS缓存中的主机名已过时,已被清除 *正在尝试195.8.209.135。。。 *连接到www.example.net(195.8.209.135)端口80(#0) >POST//POST_TEST.php HTTP/1.1 主持人:www.example.net 接受:*/* 内容长度:357 预期:100人继续 内容类型:多部分/表单数据;边界=---------------------------ba541b7fbc0d6707 未找到 编辑:看起来如果我将此代码放在另一台curl post工作的服务器上。。 有人能解释发生了什么事吗

可能的重复可能的重复
* Hostname was found in DNS cache
* Hostname in DNS cache was stale, zapped
*   Trying 195.8.209.135...
* Connected to www.example.net (195.8.209.135) port 80 (#0)
> POST //POST_TEST.php HTTP/1.1
Host: www.example.net
Accept: */*
Content-Length: 357
Expect: 100-continue
Content-Type: multipart/form-data; boundary=------------------------ba541b7fbc0d6707

< HTTP/1.1 404 Not Found
< Cache-Control: private
< Content-Type: text/html; charset=utf-8
< Server: Microsoft-IIS/8.5
< Date: Fri, 22 Apr 2016 08:03:13 GMT
< Content-Length: 4921
* HTTP error before end of send, stop sending
< 
* Closing connection 0