我无法使用curl连接到服务器

时间:2017-02-16 11:17:47

标签: php json curl

当我尝试向localhost中的服务器发送请求时,我收到以下消息:

  

错误:调用URL   https://wasl.elm.sa/WaslPortalWeb/rest/DriverRegistration/send失败了   状态为200,响应{" resultCode":503," resultMessage":" Yakeen   失败:找不到ID   NIC"," referenceNumber":0,"有效":false},curl_error,curl_errno 0

在实时服务器上,我收到此消息:

  

string(171)" {" apiKey":"我的api   密钥"" captainIdentityNumber":" 12355567897"" DATEOFBIRTH":" 15-07-1400"" EMAILADDRESS& #34;:" mo@mo.com","移动电话号码":" 966508060095"}"   错误:调用URL   https://wasl.elm.sa/WaslPortalWeb/rest/DriverRegistration/send失败了   状态为0,响应,curl_error未知的SSL协议错误   连接到wasl.elm.sa:443,curl_errno 35

我使用此脚本发出请求:

<?php

    //driver registartion url   
    $url = "https://wasl.elm.sa/WaslPortalWeb/rest/DriverRegistration/send";     
    $data=["apiKey"=>"My apikey","captainIdentityNumber"=>"1234567897","dateOfBirth"=>"15-07-1400","emailAddress"=>"mo@mo.com","mobileNumber"=>"966508060095"];
    $content = json_encode($data);
    $curl = curl_init($url);

    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HEADER,false);
    curl_setopt($curl, CURLOPT_HTTPHEADER,array("Content-type: application/json"));
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    var_dump($content);
    $json_response = curl_exec($curl);
    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    if ( $status != 201 ) {
        die("Error: call to URL $url failed with status $status, response $json_response, curl_error " . curl_error($curl) . ", curl_errno " . curl_errno($curl));
    }
    curl_close($curl);
    $response = json_decode($json_response, true);
    var_dump($response);
    ?>

我的api密钥是服务器所有者给出的正确密码

1 个答案:

答案 0 :(得分:0)

这与Wasl门户网站有关,与卷曲或连接错误无关。

您必须联系门户网站管理员,因为它是API特定的错误。