收到的HTTP方法无效.只接受POST


The HTTP method received is not valid. Only POST is accepted

好的,我有这个php文件,用于我的汇丰银行使用API处理,我在其他两个网站上都可以正常工作,但其他两个站点上的SAME文件失败了,我不知道为什么。我的网络开发人员被难住了,决定创建一个测试文件,下面是测试文件中的代码:

<?php
echo "payment processing...";
$amount = 100;// round($_POST["realamount"], 2) * 100;
$fullName = "test";//$_POST['name'];
$Address1 = "test";//$_POST['address1'];
$Address2 = "test";//$_POST['address2'];
$city ="test";// $_POST['city'];
$county = $city;
$postcode = "test";//$_POST['zipcode'];
$country = "GRB";//$_POST['country'];
$phone = "test";//$_POST['telephone'];
$email = "a@a.com";//$_POST['emailaddress'];    
$cardNumber = "337877666233434";//$_POST['cardNumber'];
$cardExp = "03/2011";//$_POST['ccmonth'] . "/" . substr($_POST["ccyear"],2,2);
$cvdIndicator = "111";//$_POST['cvdIndicator'];
$cvdValue = "111";//$_POST['cvdValue'];
$issueNumber = "111";//$_POST['issueNumber'];
$cardType = "VI";//$_POST['cardType'];

$testRead = "<?xml version='1.0' encoding='UTF-8'?>
<EngineDocList>
<DocVersion>1.0</DocVersion>
<EngineDoc>
    <ContentType>OrderFormDoc</ContentType>
    <User>
        <Name>xxx</Name>
        <Password>xxx</Password>
        <ClientId>xxx</ClientId>        
    </User>
    <Instructions>
        <Pipeline>PaymentNoFraud</Pipeline>
    </Instructions>
    <OrderFormDoc>
        <Mode>P</Mode>
        <Comments/>
        <Consumer>
            <Email/>
            <PaymentMech>
                <CreditCard>
                    <Number>".$cardNumber."</Number>
                    <Expires DataType='ExpirationDate' Locale='840'>".$cardExp."</Expires>
                    <Cvv2Val>".$cvdValue."</Cvv2Val>
                    <Cvv2Indicator>".$cvdIndicator."</Cvv2Indicator>
                    <IssueNum>".$issueNumber."</IssueNum>
                </CreditCard>
            </PaymentMech>
        </Consumer>
        <Transaction>
            <Type>Auth</Type>
            <CurrentTotals>
                <Totals>
                    <Total DataType='Money' Currency='826'>".$amount."</Total>
                </Totals>
            </CurrentTotals>
        </Transaction>
    </OrderFormDoc>
</EngineDoc>
    </EngineDocList>";
?>
<?php

//$url = "https://www.uat.apixml.netq.hsbc.com";
$url = "https://www.secure-epayments.apixml.hsbc.com/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$testRead);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$result_tmp = curl_exec ($ch);
curl_close ($ch);
///////////////////////////////////////
// use XML Parser result
   $xml_parser = xml_parser_create();
   xml_parser_set_option($xml_parser,XML_OPTION_CASE_FOLDING,0);
   xml_parser_set_option($xml_parser,XML_OPTION_SKIP_WHITE,1);
   xml_parse_into_struct($xml_parser, $result_tmp, $vals, $index);
   xml_parser_free($xml_parser);    
//print_r($vals);  // print all the arrays.
//print_r($vals[29]); // print only the selected array.
$val1 = $vals[21];
// ProcReturnMsg
$paymentResult = $val1[value];

$result_tmp = "";
$k=0;
$findthis = false;
$findthis2 = false;
foreach ($vals as $val) {
$result_tmp.= $k."{"; 
foreach($val as $d => $a) {
      $result_tmp.="[".$d."]".$a;
      if($d=="tag" && $a=="TransactionStatus"){
          $findthis = true;
      }
      if($d=="value" && $findthis){
          $tResult = $a;
          $findthis = false;
      }
      if($d=="tag" && $a=="Text"){
          $findthis2 = true;
      }
      if($d=="value" && $findthis2){
          $tResult2 = $a;
          $findthis2 = false;
      }
}  
$result_tmp.= "}"; 
$k++; 
} 

echo $tResult2.$tResult;
?>

下面是一个不工作的gs.net网站的例子输出为:付款处理。。。收到的HTTP方法无效。只接受POST。

然而,当我将这个完全相同的文件上传到我的其他一些网络主机时,例如:HGL工作示例这里的输出是付款处理。。。无法确定卡类型。("长度"为"15")E这听起来像是一个错误消息,但基本上这个错误并不重要,所以后者是我们在第一个环节中试图实现的。

我甚至把这个文件上传到了我的一些非常基本的托管账户,有时它会起作用,有时它不会起作用,所以我猜这与托管公司允许或已经打开/关闭的内容有关。

有什么想法吗?

感谢

这似乎是由应用于服务器的PHP升级引起的,这让我抓狂。

解决方案是在指定CURL连接时设置以下SSL选项。

curl_setopt($ch, CURLOPT_SSLVERSION, 3);
curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, 'RC4-MD5');

检查那些不适用于初学者的服务器上是否启用了curl。使用phiinfo()函数进行检查。