Rest API failed with cURL

Hi there,
I am trying to call rest API with php without luck!
I am able to call demo account with rest API throw php cURL but not able to call www.xx.xx.xx.x:83 my server !
I try to call them both with postman and it successful but with php cURL for my server it is failed!

I use this code :


$ch = curl_init( "" );
# Setup request to send json via POST.

curl_setopt( $ch, CURLOPT_POSTFIELDS,  array(
'usr' => '',
'pwd' => 'xxxxxxx' )  );

curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );

$result = curl_exec($ch);
# Print response.
echo "<pre>$result</pre>";

Is your port 83? You need to specify that in your request in the code.

thanks for you reply but it is the same, i add this to code :

curl_setopt( $ch, CURLOPT_PORT, '83' );

not working!

Are you calling your ip with https protocol as well?

What’s your curl error for the failed request?

@Felipe_Orellana no, I dont get any error but the request take long time to respond and return 0!

you can try my code hear :


$ch = curl_init( “” );

curl_setopt( $ch, CURLOPT_POSTFIELDS, array(
‘usr’ => ‘Administrator’,
‘pwd’ => ‘12345678’ ) );

curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_PORT, ‘83’ );

$result = curl_exec($ch);

echo $result;

So, I just tried your code and it seems to work for me:

{“home_page”:“/desk”,“message”:“Logged In”,“full_name”:“Administrator”}

My guess is that either your server or isp where you are doing the call from is blocking outgoing port 83 connections?

Not really sure

1 Like

but i tried with postman and it is working fine with 83
It is not working only with cURL!

Are you using postman on the same machine your are running curl from?