Title: PHP check server status (online offline) Post by: TAiS46 on October 17, 2012, 07:43:18 PM Hey,
I am trying to get the server status with PHP. Is the Server offline or online. Code: <?php dose not work, any idea? Title: Re: PHP check server status (online offline) Post by: Raoul Duke on October 17, 2012, 07:49:10 PM Code: <?php Try that. Or something alike. the new jsonRPCClient command only opens the connection, you need to ask something to the server to get a response. Title: Re: PHP check server status (online offline) Post by: TAiS46 on October 17, 2012, 07:53:40 PM already tried.
Getting an 403 Forbidden error page. Title: Re: PHP check server status (online offline) Post by: Raoul Duke on October 17, 2012, 07:55:59 PM already tried. Getting an 403 Forbidden error page. The credentials are wrong, most likely. Maybe this is useful: Source code: https://github.com/mikegogulski/bitcoin-php Documentation: http://code.gogulski.com/bitcoin-php Title: Re: PHP check server status (online offline) Post by: BCB on October 17, 2012, 08:12:32 PM Are you making the call from a second box?
If credentials were wrong you'd be getting "Unable to connect to ..." with display errors. Original code works. Title: Re: PHP check server status (online offline) Post by: Raoul Duke on October 17, 2012, 08:19:57 PM Are you making the call from a second box? ah!rpcallowip=xxx.xxx.xxx.xxx :P good call That 403 would be returned if the flag was not set on bitcoin.conf ;) Title: Re: PHP check server status (online offline) Post by: TAiS46 on October 17, 2012, 08:21:59 PM rpcallow etc is all set!
if the server is online, $bitcoin->getinfo(); works. I am trying now to get the status with fsockopen or other php commands hmmm Title: Re: PHP check server status (online offline) Post by: BCB on October 17, 2012, 08:26:27 PM if rpc allow was not set you'd be getting "failed to open stream: Connection refused"
Title: Re: PHP check server status (online offline) Post by: TAiS46 on October 17, 2012, 08:30:03 PM Found a solution:
Code: <?php Title: Re: PHP check server status (online offline) Post by: BCB on October 17, 2012, 08:32:40 PM are you on shared boxes? sounds like a file or folder permission issue
Title: Re: PHP check server status (online offline) Post by: TAiS46 on October 17, 2012, 08:35:09 PM no, everything dose work, dose someone try out to get the offline status?
i dont think so. using now the curl methode :) Title: Re: PHP check server status (online offline) Post by: kjj on October 21, 2012, 03:47:38 PM How about a try/catch block?
Code: <?php |