You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Curl error 'Couldn't connect to host'

Received Response
edited Jun 27, 2017 3:10PM in Integrations and APIs 3 comments


Hi all,

I am writing a custom script in cPHP which makes POST requests to webservice API using Curl.

I have tested the API using external tools (postman) from my computer and it worked fine but when I try to implement it from custom script using curl, I am getting an error saying 'Couldn't connect to host'. 

is there any restriction/configuration requirements in RightNow which is preventing me to connect to API?



Code Snippet

             	               curl_setopt($curl_connection, CURLOPT_URL, "");

			curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
			curl_setopt($curl_connection, CURLOPT_CUSTOMREQUEST, "POST");
			curl_setopt($curl_connection, CURLOPT_USERPWD , "myusername:mypassword");
			curl_setopt($curl_connection, CURLOPT_POSTFIELDS,$json_request);
			curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, 0);
			curl_setopt($curl_connection, CURLOPT_SSL_VERIFYHOST, 0); 

Howdy, Stranger!

Log In

To view full details, sign in.


Don't have an account? Click here to get started!