Hi,

The NING API has suddenly stopped working for me.
I have not made any changes to my code or site for a while.
My API Keys are correct.

The call to NING API is just hanging.

A snippet of the code where it fails is as follows:

----------------------------------------------------------

require_once('ning-api-php/NingApi.php');

//Get HTTP vars
$author = trim($_GET['author']);

//echo "The author is:".$author;
$args = array(
    "author" => $author
);

// Get ning user profile info
$result = NingApi::instance()->user->fetch($args );  <----- HANGS HERE!!!!!
$email = $result['entry']['email'];

-------------------------------------------------------------

It never returns from the NingApi::instance()->user call

Alex

Views: 241

Reply to This

Replies to This Discussion

Is this problem still happening?  I just did a quick test and I get an immediate response from the server.

Yes it still hangs.

What would be the reason for that call to fail?

$result = NingApi::instance()->user->fetch($args );

Alex

I did a really simple test.

Test code is:


require_once('ning-api-php/NingApi.php');

echo "Fetch Recent Photos..";
// Get the most recent photo
$result = NingApi::instance()->photo->fetchNRecent();
echo "I am back...";
print_r($result);

Output I get in my browser is:

Fetch Recent Photos..

Are you sure it's hanging, or is it throwing an exception and killing the request at that point? Try this:

require_once('ning-api-php/NingApi.php');

echo "Fetch Recent Photos..";
// Get the most recent photo
try {
  $result = NingApi::instance()->photo->fetchNRecent();
  echo "I am back...";
  print_r($result);
} catch (Exception $e) {
  echo "Error: ".$e->getMessage()."\n".$e->getTraceAsString();
}

Hi Philip,

Thank you so much for your help so far.

This is the response I get back with the code you posted above:

Fetch Recent Photos..Error: The oauth_timestamp value is unacceptable to the Service Provider. The timestamp of the request must be within 300 seconds of the current time Acceptable range: 1336346254-1336346855 #0 /var/www/app.royalcanin.ca/ning/api/ning-api-php/NingApi.php(213): NingException::generate(Array) #1 /var/www/app.royalcanin.ca/ning/api/ning-api-php/NingApi.php(220): NingApi->call('Token', 'POST', NULL, Array, true) #2 /var/www/app.royalcanin.ca/ning/api/ning-api-php/NingApi.php(119): NingApi->post('Token', NULL, Array, true) #3 /var/www/app.royalcanin.ca/ning/api/ning-api-php/NingApi.php(61): NingApi->login('nblackwell@roya...', 'Royalcan1n') #4 /var/www/app.royalcanin.ca/ning/api/ning-api-php/NingApi.php(34): NingApi->__construct() #5 /var/www/app.royalcanin.ca/ning/api/test.php(19): NingApi::instance() #6 {main}

--------------------------------------------------------------------

Is this my server that has the dodgy time?

Is the upshot of this my hosting server has it's time out of whack?

Cheers

Alex

ok, it's 7:39pm here.

I added the code:

echo date("m/d/Y h:i:s a", time());

My server thinks it is 11:30pm.
I'll contact my hosting provider and see what is going on.

Thanks Phillip.

Alex

Ahh... yes, that sounds like the problem.  Your server's probably in a different timezone, but if it thinks it's xx:30 when it's actually xx:39, that's enough for the timestamp to be incorrect.  300 seconds is 5 minutes, so 9 mins off is far too much!  Let me know if the problem doesn't go away once your provider updates its clocks :)

(Your provider probably knows this already, but just in case they don't: they should be running some kind of ntp listener, to track one of the publicly available Internet time services and keep their servers in sync.)

Cheers Phillip,

The provider has updated the clocks and all is working great.

Thanks for your help with debugging, I would not have figured this out without your help.

Alex

Awesome, glad to hear it's all working!

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

500 error on some Ning Networks

Hello! Due to the maintenance in the Ning systems, 500 errors might appear on some Ning Networks.It usually takes up to 20 minutes for our technical team to solve such issues. We do apologize for the inconveniences, but the maintenance works are necessary for stabilizing our systems and improving their functionality in future. Regards, Ning Team

© 2017   Created by Build Team.   Powered by

Badges  |  Report an Issue  |  Terms of Service