Ning PHP API connection issue - Build2024-03-28T18:34:19Zhttp://build.ning.com/forum/topics/ning-php-api-connection-issue?commentId=6308082%3AComment%3A5342&feed=yes&xn_auth=noI got it working, um turns ou…tag:build.ning.com,2011-06-22:6308082:Comment:53422011-06-22T11:10:37.024ZVincenthttp://build.ning.com/profile/Vincent
<p>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.</p>
<p> </p>
<p>peeeuuuu....</p>
<p><br></br> <cite>Devin said:</cite></p>
<blockquote cite="http://build.ning.com/forum/topics/ning-php-api-connection-issue?xg_source=activity#6308082Comment5232"><div><p class="level1">Vincent, if I understand you correctly, you have tried connecting directly to the Ning API…</p>
</div>
</blockquote>
<p>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.</p>
<p> </p>
<p>peeeuuuu....</p>
<p><br/> <cite>Devin said:</cite></p>
<blockquote cite="http://build.ning.com/forum/topics/ning-php-api-connection-issue?xg_source=activity#6308082Comment5232"><div><p class="level1">Vincent, if I understand you correctly, you have tried connecting directly to the Ning API and by using a proxy connection? <a href="http://curl.haxx.se/libcurl/c/libcurl-errors.html" target="_blank">curl error #7 translates</a> to "Failed to connect() to host or proxy." This implies that you can't see the Ning API at all.</p>
<p class="level1"> </p>
<p class="level1">Try making a request using the curl command line tool on your computer and let me know the output:</p>
<blockquote><p class="level1">curl 'http://external.ningapis.com/'</p>
</blockquote>
<p class="level1"> </p>
<p class="level1">You should see something like:</p>
<blockquote><p class="level1">{"success":false,"reason":"Not Found: null","status":404,"code":2,"subcode":2,"trace":"70d7adba-74f9-4cf9-96f3-68d0d9268554"}</p>
</blockquote>
<p class="level1">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.</p>
<p class="level1"> </p>
<p class="level1">Let me know if you have further questions!</p>
</div>
</blockquote> I dont know what changed but…tag:build.ning.com,2011-06-21:6308082:Comment:52342011-06-21T13:16:49.957ZVincenthttp://build.ning.com/profile/Vincent
<p>I dont know what changed but all of a sudden im getting this output from my browser:</p>
<p> </p>
<p>{"success":false,"reason":"Not Found: null","status":404,"code":2,"subcode":2,"trace":"e6507ef0-31a6-402b-83c0-f2b29ac238d4"}</p>
<p> </p>
<p>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…</p>
<p>I dont know what changed but all of a sudden im getting this output from my browser:</p>
<p> </p>
<p>{"success":false,"reason":"Not Found: null","status":404,"code":2,"subcode":2,"trace":"e6507ef0-31a6-402b-83c0-f2b29ac238d4"}</p>
<p> </p>
<p>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.</p>
<p> </p>
<p>Thanks</p>
<p>Vincent<br/> <br/>
<cite>Devin said:</cite></p>
<blockquote cite="http://build.ning.com/forum/topics/ning-php-api-connection-issue#6308082Comment5232"><div><p class="level1">Vincent, if I understand you correctly, you have tried connecting directly to the Ning API and by using a proxy connection? <a href="http://curl.haxx.se/libcurl/c/libcurl-errors.html" target="_blank">curl error #7 translates</a> to "Failed to connect() to host or proxy." This implies that you can't see the Ning API at all.</p>
<p class="level1"> </p>
<p class="level1">Try making a request using the curl command line tool on your computer and let me know the output:</p>
<blockquote><p class="level1">curl 'http://external.ningapis.com/'</p>
</blockquote>
<p class="level1"> </p>
<p class="level1">You should see something like:</p>
<blockquote><p class="level1">{"success":false,"reason":"Not Found: null","status":404,"code":2,"subcode":2,"trace":"70d7adba-74f9-4cf9-96f3-68d0d9268554"}</p>
</blockquote>
<p class="level1">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.</p>
<p class="level1"> </p>
<p class="level1">Let me know if you have further questions!</p>
</div>
</blockquote> Hi Devin,
Thanks for the re…tag:build.ning.com,2011-06-21:6308082:Comment:56022011-06-21T12:13:39.696ZVincenthttp://build.ning.com/profile/Vincent
<p>Hi Devin,</p>
<p> </p>
<p>Thanks for the response.</p>
<p>I made the curl call from the command line and got the result as you predicted.</p>
<p> </p>
<p>Since this means that my NingApi.php file is incorrectly configured I'll paste the configuration portion of the class.</p>
<blockquote><p>const SECURE_PROTOCOL = 'https://';</p>
<p>const INSECURE_PROTOCOL = 'http://';</p>
<p>const BASE_URL = 'http://external.ningapis.com/xn/rest';</p>
<p>const API_VERSION = '1.0';</p>
<p>// The maximum…</p>
</blockquote>
<p>Hi Devin,</p>
<p> </p>
<p>Thanks for the response.</p>
<p>I made the curl call from the command line and got the result as you predicted.</p>
<p> </p>
<p>Since this means that my NingApi.php file is incorrectly configured I'll paste the configuration portion of the class.</p>
<blockquote><p>const SECURE_PROTOCOL = 'https://';</p>
<p>const INSECURE_PROTOCOL = 'http://';</p>
<p>const BASE_URL = 'http://external.ningapis.com/xn/rest';</p>
<p>const API_VERSION = '1.0';</p>
<p>// The maximum number of seconds to allow cURL to execute </p>
<p>const CURL_TIMEOUT = 10; </p>
<p>// Ning network subdomain (ie. 'apiexample' in apiexample.ning.com) </p>
<p>public $subdomain = 'misszag.ning.com'; </p>
<p>// Ning user email address </p>
<p>protected $email = 'ning user email'; </p>
<p>// Ning user password protected $password = 'password'; </p>
<p>// Consumer key found at [subdomain].ning.com/main/extend/keys </p>
<p>protected $consumerKey = 'my consumer key'; </p>
<p>// Consumer secret found at [subdomain].ning.com/main/extend/keys </p>
<p>protected $consumerSecret = 'my secret key'; </p>
<p>protected $requestToken = null; </p>
<p>private static $_instance = null;</p>
</blockquote>
<p>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 </p>
<p>curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);</p>
<p>curl_setopt($ch, CURLOPT_PROXY, "proxy address");</p>
<p> </p>
<p>the error code becomes "6" C<span class="nroffip">URLE_COULDNT_RESOLVE_HOST.</span></p>
<p> </p>
<p>Vincent</p>
<p> </p> Vincent, if I understand you…tag:build.ning.com,2011-06-20:6308082:Comment:52322011-06-20T23:28:33.853ZDevinhttp://build.ning.com/profile/Devin
<p class="level1">Vincent, if I understand you correctly, you have tried connecting directly to the Ning API and by using a proxy connection? <a href="http://curl.haxx.se/libcurl/c/libcurl-errors.html" target="_blank">curl error #7 translates</a> to "Failed to connect() to host or proxy." This implies that you can't see the Ning API at all.</p>
<p class="level1"> </p>
<p class="level1">Try making a request using the curl command line tool on your computer and let me know the…</p>
<p class="level1">Vincent, if I understand you correctly, you have tried connecting directly to the Ning API and by using a proxy connection? <a href="http://curl.haxx.se/libcurl/c/libcurl-errors.html" target="_blank">curl error #7 translates</a> to "Failed to connect() to host or proxy." This implies that you can't see the Ning API at all.</p>
<p class="level1"> </p>
<p class="level1">Try making a request using the curl command line tool on your computer and let me know the output:</p>
<blockquote><p class="level1">curl 'http://external.ningapis.com/'</p>
</blockquote>
<p class="level1"> </p>
<p class="level1">You should see something like:</p>
<blockquote><p class="level1">{"success":false,"reason":"Not Found: null","status":404,"code":2,"subcode":2,"trace":"70d7adba-74f9-4cf9-96f3-68d0d9268554"}</p>
</blockquote>
<p class="level1">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.</p>
<p class="level1"> </p>
<p class="level1">Let me know if you have further questions!</p>