[asterisk-users] problem to socket programming in AGI
A J Stiles
asterisk_list at earthshod.co.uk
Mon Feb 4 11:26:31 CST 2013
On Monday 04 February 2013, Muhammad wrote:
> I know maybe this question is not related to asterisk, but I want to make
> XML RPC web service to other http server.
> I have elastix system. it is https and problem is source not destination
> server. In xml rpc we have fsockopen connection to connect destination
> server(xml rpc server). It return me connect error(0).
> what is the problem. is this related to elastix(asterisk) server?
If your call to fsockopen() is returning false, then the socket connection is
not being opened. You need to work out why this is the case first. This
probably will mean writing a quick standalone script for testing.
First, run the test script on the destination machine. Can you persuade it
open a socket on localhost? Then that means something is at least listening
for connections. If you can open a socket locally but not remotely, check the
config files for the daemon to make sure it isn't binding to 127.0.0.1, or
But ..... you may not even need to use fsockopen() if it's just an ordinary
HTTPS connection. You should be able to use curl or wget. (in PHP, you can
use `backticks` like this:
$all_files = `ls -alR /`
which will execute the command between the `` marks -- ls -alR / -- and put
the output into the variable $all_files .) Again, try this on the destination
machine first to make sure it works at all, then try it remotely.
By the way, you only ever need \r\n as a line ending when talking to a Windows
server. Real servers are happy with just \n!
Answers come *after* questions.
More information about the asterisk-users