The curl connection on the NingAPI returns the #"7" error code every time I try to connect to my network

 

I'm think it might be caused by the fact that my offices are behind a proxy.

I tried adding this code to the curl connection code but it still returns "a connection failed error".

 

curl_setopt($ch, CURLOPT_TIMEOUT, self::CURL_TIMEOUT);

curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);

curl_setopt($ch, CURLOPT_PROXY, "proxy address");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); 

 

Any help is appreciated thanks in advance.

Views: 336

Reply to This

Replies to This Discussion

Vincent, if I understand you correctly, you have tried connecting directly to the Ning API and by using a proxy connection? curl error #7 translates to "Failed to connect() to host or proxy." This implies that you can't see the Ning API at all.

 

Try making a request using the curl command line tool on your computer and let me know the output:

curl 'http://external.ningapis.com/'

 

You should see something like:

{"success":false,"reason":"Not Found: null","status":404,"code":2,"subcode":2,"trace":"70d7adba-74f9-4cf9-96f3-68d0d9268554"}

You should see something similar to that output, it implies that your computer can see the Ning API server. The issue will most likely be in your configuration of NingAPI.php.

 

Let me know if you have further questions!

Hi Devin,

 

Thanks for the response.

I made the curl call from the command line and got the result as you predicted.

 

Since this means that my NingApi.php file is incorrectly configured I'll paste the configuration portion of the class.

const SECURE_PROTOCOL = 'https://';

const INSECURE_PROTOCOL = 'http://';

const BASE_URL = 'http://external.ningapis.com/xn/rest';

const API_VERSION = '1.0';

// The maximum number of seconds to allow cURL to execute    

const CURL_TIMEOUT = 10;    

// Ning network subdomain (ie. 'apiexample' in apiexample.ning.com)    

public $subdomain = 'misszag.ning.com';    

// Ning user email address    

protected $email = 'ning user email';    

// Ning user password    protected $password = 'password';    

// Consumer key found at [subdomain].ning.com/main/extend/keys    

protected $consumerKey = 'my consumer key';    

// Consumer secret found at [subdomain].ning.com/main/extend/keys    

protected $consumerSecret = 'my secret key';    

protected $requestToken = null;    

private static $_instance = null;

If there's anything else i can paste let me know,  another thing is when i remove this bit of code form the call method 

curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);

curl_setopt($ch, CURLOPT_PROXY, "proxy address");

 

the error code becomes "6" CURLE_COULDNT_RESOLVE_HOST.

 

Vincent

 

I dont know what changed but all of a sudden im getting this output from my browser:

 

{"success":false,"reason":"Not Found: null","status":404,"code":2,"subcode":2,"trace":"e6507ef0-31a6-402b-83c0-f2b29ac238d4"}

 

and when i output the error no i get a curl error code of "0" although the "0" means curl connection success. im not getting my desired result. I do think that hopefully this is step forward and could help identify my NingApi.php configuration issue.

 

Thanks

Vincent

Devin said:

Vincent, if I understand you correctly, you have tried connecting directly to the Ning API and by using a proxy connection? curl error #7 translates to "Failed to connect() to host or proxy." This implies that you can't see the Ning API at all.

 

Try making a request using the curl command line tool on your computer and let me know the output:

curl 'http://external.ningapis.com/'

 

You should see something like:

{"success":false,"reason":"Not Found: null","status":404,"code":2,"subcode":2,"trace":"70d7adba-74f9-4cf9-96f3-68d0d9268554"}

You should see something similar to that output, it implies that your computer can see the Ning API server. The issue will most likely be in your configuration of NingAPI.php.

 

Let me know if you have further questions!

I got it working, um turns out if i pass the url of my network like a ziss mynetwork.ning.com it fails bit if i ass it my network name it works. i just didnt read the instructions properly.

 

peeeuuuu....


Devin said:

Vincent, if I understand you correctly, you have tried connecting directly to the Ning API and by using a proxy connection? curl error #7 translates to "Failed to connect() to host or proxy." This implies that you can't see the Ning API at all.

 

Try making a request using the curl command line tool on your computer and let me know the output:

curl 'http://external.ningapis.com/'

 

You should see something like:

{"success":false,"reason":"Not Found: null","status":404,"code":2,"subcode":2,"trace":"70d7adba-74f9-4cf9-96f3-68d0d9268554"}

You should see something similar to that output, it implies that your computer can see the Ning API server. The issue will most likely be in your configuration of NingAPI.php.

 

Let me know if you have further questions!

Reply to Discussion

RSS

Blog Posts

Getting Started

Posted by Kyle Ford on October 13, 2010 at 8:00am 3 Comments

A Note on API Pricing

Posted by Phil McCluskey on October 1, 2010 at 8:55am 0 Comments

Welcome to Build!

Posted by Kyle Ford on September 30, 2010 at 8:30pm 1 Comment

Ning Status

© 2024   Created by Build Team.   Powered by

Badges  |  Report an Issue  |  Terms of Service