web API POST curl返回'没有找到任何与请求URI'匹配的内容


web API POST curl returns 'not found anything matching the request URI'

我尝试访问json编码的web api和php中的$POST方法。几次尝试后,我得到这样的消息:

Not Found -服务器没有找到任何与请求URI匹配的内容你可以在这里了解技术细节。请继续访问我们的网站主页。

为什么?谢谢,我的代码是:

 <?php
    ini_set('display_errors', 1);
    error_reporting(E_ALL);
    //DADOS DE ACESSO
    $id = "xxx";
    $retailerName = "xxx";
    $key = "xxx";
    //PRODUTO
    //vars of product:fictional data
    $upc = "799366289999";
    $amount = "20.00";
    //URL DE ACESSO
    $function = "requestActivateCode";
    //usado pra criar a canonical
    $resPath = "/v1/activateCode";
    $url = "https://111.222.333.444/v1/";
    $urlCall = $url.$function;
    //HTTP HEADERS
    $date = gmdate("M, d Y H:i:s 'G'M'T", time());
    $contentType = "Content-Type: application/json; charset=UTF-8";
    $accept = "Accept: application/json";
    $xIncommDateTime = substr(substr_replace(date('c'), substr(round(microtime(), 3), 1, 8), 19, 0), 0, -6) . "Z";
    //authorization
    $type = "application/json; charset=UTF-8";
    $canonical = ($xIncommDateTime) + ($type) + ($resPath);
    $signature = hash_hmac ('sha1', $key, $canonical);
    $idEncoded = base64_encode($id);
    $signatureEncoded = base64_encode($signature);
    $authorization = "Incomm ". $idEncoded .':'. $signatureEncoded;
    $header = array("Date: ".$date, $contentType, $accept, "X-Incomm-DateTime: ".$xIncommDateTime, "Authorization: ".$authorization);

    //PARAMS example
    $params = array("RetailTransactionRequest" =>
        array(
            "code" => "0000002381237220",
            "amount" => $amount,
            "upc" => $upc,
            "transactionID" => "1234",
            "dateTime" => $xIncommDateTime,
            "retailerName" => $retailerName
        )
    );
    $request = json_encode($params);

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $urlCall);
    //curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);  
    //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
    //curl_setopt($ch, CURLOPT_SSLVERSION, 1);
    //curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
    curl_setopt($ch, CURLOPT_PORT, 443);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,0);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
    echo curl_setopt($ch, CURLINFO_HEADER_OUT, true); // enable tracking
    $result = curl_exec($ch);
    echo $result;
    $headerSent = curl_getinfo($ch, CURLINFO_HEADER_OUT ); // request headers
    echo "<pre>";
    print_r($headerSent);
    echo "</pre>";
    if($result === false)
    {
        echo 'Curl error: ' . curl_error($ch);
    }
    else
    {
        echo 'Operation completed without any errors';
        echo "<pre>";
        print_r($result);
        echo "</pre>";
    }

netstat -l ip中,我的端口443正在侦听,但ping中的主机没有。我想知道如何解决这个问题,谢谢

如果代码正是所示,我不认为您的服务器的ip地址是正确的。不要使用示例中使用的IP地址(111.222.333.444),请替换为站点的IP地址或站点的域名。

$url = "https://111.222.333.444/v1/"