Hello
I am using PHP CURL code for accessing api but unfortunately i got below mentioned ERROR.
My Code:
$url = "https://telenorcsms.com.pk:27677/corporate_sms2/api/auth.jsp?msisdn=xxxx&password=xxxx"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url ); //curl_setopt($ch, CURLOPT_PORT, $port); curl_setopt($ch, CURLOPT_POST, 1 ); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $postResult = curl_exec($ch); if (curl_errno($ch)) { print curl_error($ch); } curl_close($ch); echo $postResult;
For checking purpose i used this code to another hosting panel rather than godaddy it's perfectly working so i think its my hosting issue. Please let me know if there is any setting which i need to update my account for using this API.
Thanks.
Curl error : Failed to connect to affiliate-api.mysite.com port 4477: Connection refusedbool(false)
I have the same error! I read other users questions, I think the problem is in port.
how to send request for open port ?
need help!
I tested the query on a other hosting - Everything works fine!
PLZ open port 4477 in firewall !!!!!!!!!!!!!
<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://affiliate-api.mysite.com:4477/token'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, '{"userName":"MyName","password":"Pssword"}'); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/json', 'Accept: application/json')); $out = curl_exec($ch); if ($out === false) { echo 'Curl error : ' . curl_error($ch); } curl_close($ch); var_dump($out); ?>