Hi,

Which version of APE?

Basically to check with PHP if it's down, just prefix your file_get_content with a @ => @file_get_content() and check the value returned (should be FALSE in case of failure).

Le 10/06/2011 18:18, Nicolas a écrit :
Hi,

On the PHP side, I have got the following line:

$data = file_get_contents($APEserver.rawurlencode(json_encode($cmd)));

And on the APE server side, I have:

Ape.registerCmd("REGISTER_USER", false, function(params, info)
{
     Ape.log("REGISTER_USER - The user ip : ("+info.ip+"), check_key :
" + params.check_key+ "- activation_key : " + params.activation_key+"-
user_id :"+params.user_id);

     // Here I am storing into two arrays some of the info reiceved,
only two lines of code

     Ape.log("REGISTER_USER OK FINISHED");

});

Most of the time, it works well, but sometimes, I get the dreadful
message:

Warning: file_get_contents(http://ape.local.ape-project.org:6969/?%5B
%7B%22cmd%22%3A%22REGISTER_USER%22%2C%22params%22%3A%7B%22name%22%3A
%22register_user%22%2C%22user_id%22%3A%22101%22%2C%22check_key%22%3A
%22gl3il84vae7is9ktkv6ehl3151%22%2C%22activation_key%22%3A%22TCPnKEeZiX
%22%7D%7D%5D): failed to open stream:

I have one explanation for this. Correct me if I am wrong.

Most of the time, APE sends the response back to the one who queried
him straight away, but sometimes, it only does it a few milli-seconds
later. So most of the time, PHP gets a response, but sometimes it gets
nothing.

Is that the correct explanation for what I see?

And if so, then how do I test that the APE server is not down via PHP?
Because that is what I am trying to do. I try to register the user for
APE via PHP (because I want to pass some secret key), but I obviously
want to know if there was any response...





--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/

Reply via email to