Walid azouzi
Walid azouzi

Reputation: 81

I can't connect to server using curl

When I try to send request to the server in localhost I receive this message :

Error: call to URL https://wasl.elm.sa/WaslPortalWeb/rest/DriverRegistration/send failed with status 200, response {"resultCode":503,"resultMessage":"Yakeen Failure: The ID Is Not Found at NIC","referenceNumber":0,"valid":false}, curl_error , curl_errno 0

On the live server I receive this message :

string(171) "{"apiKey":"My api key","captainIdentityNumber":"12355567897","dateOfBirth":"15-07-1400","emailAddress":"[email protected]","mobileNumber":"966508060095"}" Error: call to URL https://wasl.elm.sa/WaslPortalWeb/rest/DriverRegistration/send failed with status 0, response , curl_error Unknown SSL protocol error in connection to wasl.elm.sa:443 , curl_errno 35

I use this script to make the request:

<?php

    //driver registartion url   
    $url = "https://wasl.elm.sa/WaslPortalWeb/rest/DriverRegistration/send";     
    $data=["apiKey"=>"My apikey","captainIdentityNumber"=>"1234567897","dateOfBirth"=>"15-07-1400","emailAddress"=>"[email protected]","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);
    ?>

my api key it's correct one given by the server owner

Upvotes: 2

Views: 1404

Answers (1)

Mostafa Alayesh
Mostafa Alayesh

Reputation: 128

This is related to Wasl portal, it is not related to curl or connection errors.

You have to contact the portal admins because it is API specific error.

Upvotes: 0

Related Questions