<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
code
        {font-family:"Courier New";}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>You are correct, this is not an asterisk
question. What I would suggest would be to run your script outside of asterisk
and debug the connection. Looking at the php doc page for fsockopen (<a
href="http://php.net/manual/en/function.fsockopen.php">http://php.net/manual/en/function.fsockopen.php</a>),
I see this example:<o:p></o:p></span></font></p>
<p class=MsoNormal><code><font size=2 color="#0000bb" face="Courier New"><span
style='font-size:10.0pt;color:#0000BB'><?php</span></font></code><font
size=2 color="#0000bb" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#0000BB'><br>
<code><font face="Courier New">$fp </font></code></span></font><code><font
size=2 color="#007700" face="Courier New"><span style='font-size:10.0pt;
color:#007700'>= </span></font></code><code><font size=2 color="#0000bb"
face="Courier New"><span style='font-size:10.0pt;color:#0000BB'>fsockopen</span></font></code><code><font
size=2 color="#007700" face="Courier New"><span style='font-size:10.0pt;
color:#007700'>(</span></font></code><code><font size=2 color="#dd0000"
face="Courier New"><span style='font-size:10.0pt;color:#DD0000'>"www.example.com"</span></font></code><code><font
size=2 color="#007700" face="Courier New"><span style='font-size:10.0pt;
color:#007700'>, </span></font></code><code><font size=2 color="#0000bb"
face="Courier New"><span style='font-size:10.0pt;color:#0000BB'>80</span></font></code><code><font
size=2 color="#007700" face="Courier New"><span style='font-size:10.0pt;
color:#007700'>, </span></font></code><code><font size=2 color="#0000bb"
face="Courier New"><span style='font-size:10.0pt;color:#0000BB'>$errno</span></font></code><code><font
size=2 color="#007700" face="Courier New"><span style='font-size:10.0pt;
color:#007700'>, </span></font></code><code><font size=2 color="#0000bb"
face="Courier New"><span style='font-size:10.0pt;color:#0000BB'>$errstr</span></font></code><code><font
size=2 color="#007700" face="Courier New"><span style='font-size:10.0pt;
color:#007700'>, </span></font></code><code><font size=2 color="#0000bb"
face="Courier New"><span style='font-size:10.0pt;color:#0000BB'>30</span></font></code><code><font
size=2 color="#007700" face="Courier New"><span style='font-size:10.0pt;
color:#007700'>);</span></font></code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#007700'><br>
<code><font face="Courier New">if (!</font></code></span></font><code><font
size=2 color="#0000bb" face="Courier New"><span style='font-size:10.0pt;
color:#0000BB'>$fp</span></font></code><code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;color:#007700'>) {</span></font></code><font
size=2 color="#007700" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#007700'><br>
<code><font face="Courier New"> echo </font></code></span></font><code><font
size=2 color="#dd0000" face="Courier New"><span style='font-size:10.0pt;
color:#DD0000'>"</span></font></code><code><font size=2 color="#0000bb"
face="Courier New"><span style='font-size:10.0pt;color:#0000BB'>$errstr</span></font></code><code><font
size=2 color="#dd0000" face="Courier New"><span style='font-size:10.0pt;
color:#DD0000'> (</span></font></code><code><font size=2 color="#0000bb"
face="Courier New"><span style='font-size:10.0pt;color:#0000BB'>$errno</span></font></code><code><font
size=2 color="#dd0000" face="Courier New"><span style='font-size:10.0pt;
color:#DD0000'>)<br />\n"</span></font></code><code><font
size=2 color="#007700" face="Courier New"><span style='font-size:10.0pt;
color:#007700'>;</span></font></code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#007700'><br>
<code><font face="Courier New">} else {</font></code><br>
<code><font face="Courier New"> </font></code></span></font><code><font
size=2 color="#0000bb" face="Courier New"><span style='font-size:10.0pt;
color:#0000BB'>$out </span></font></code><code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;color:#007700'>= </span></font></code><code><font
size=2 color="#dd0000" face="Courier New"><span style='font-size:10.0pt;
color:#DD0000'>"GET / HTTP/1.1\r\n"</span></font></code><code><font
size=2 color="#007700" face="Courier New"><span style='font-size:10.0pt;
color:#007700'>;</span></font></code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#007700'><br>
<code><font face="Courier New"> </font></code></span></font><code><font
size=2 color="#0000bb" face="Courier New"><span style='font-size:10.0pt;
color:#0000BB'>$out </span></font></code><code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;color:#007700'>.= </span></font></code><code><font
size=2 color="#dd0000" face="Courier New"><span style='font-size:10.0pt;
color:#DD0000'>"Host: www.example.com\r\n"</span></font></code><code><font
size=2 color="#007700" face="Courier New"><span style='font-size:10.0pt;
color:#007700'>;</span></font></code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#007700'><br>
<code><font face="Courier New"> </font></code></span></font><code><font
size=2 color="#0000bb" face="Courier New"><span style='font-size:10.0pt;
color:#0000BB'>$out </span></font></code><code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;color:#007700'>.= </span></font></code><code><font
size=2 color="#dd0000" face="Courier New"><span style='font-size:10.0pt;
color:#DD0000'>"Connection: Close\r\n\r\n"</span></font></code><code><font
size=2 color="#007700" face="Courier New"><span style='font-size:10.0pt;
color:#007700'>;</span></font></code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#007700'><br>
<code><font face="Courier New"> </font></code></span></font><code><font
size=2 color="#0000bb" face="Courier New"><span style='font-size:10.0pt;
color:#0000BB'>fwrite</span></font></code><code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;color:#007700'>(</span></font></code><code><font
size=2 color="#0000bb" face="Courier New"><span style='font-size:10.0pt;
color:#0000BB'>$fp</span></font></code><code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;color:#007700'>, </span></font></code><code><font
size=2 color="#0000bb" face="Courier New"><span style='font-size:10.0pt;
color:#0000BB'>$out</span></font></code><code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;color:#007700'>);</span></font></code><font
size=2 color="#007700" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#007700'><br>
<code><font face="Courier New"> while (!</font></code></span></font><code><font
size=2 color="#0000bb" face="Courier New"><span style='font-size:10.0pt;
color:#0000BB'>feof</span></font></code><code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;color:#007700'>(</span></font></code><code><font
size=2 color="#0000bb" face="Courier New"><span style='font-size:10.0pt;
color:#0000BB'>$fp</span></font></code><code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;color:#007700'>)) {</span></font></code><font
size=2 color="#007700" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#007700'><br>
<code><font face="Courier New"> echo </font></code></span></font><code><font
size=2 color="#0000bb" face="Courier New"><span style='font-size:10.0pt;
color:#0000BB'>fgets</span></font></code><code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;color:#007700'>(</span></font></code><code><font
size=2 color="#0000bb" face="Courier New"><span style='font-size:10.0pt;
color:#0000BB'>$fp</span></font></code><code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;color:#007700'>, </span></font></code><code><font
size=2 color="#0000bb" face="Courier New"><span style='font-size:10.0pt;
color:#0000BB'>128</span></font></code><code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;color:#007700'>);</span></font></code><font
size=2 color="#007700" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#007700'><br>
<code><font face="Courier New"> }</font></code><br>
<code><font face="Courier New"> </font></code></span></font><code><font
size=2 color="#0000bb" face="Courier New"><span style='font-size:10.0pt;
color:#0000BB'>fclose</span></font></code><code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;color:#007700'>(</span></font></code><code><font
size=2 color="#0000bb" face="Courier New"><span style='font-size:10.0pt;
color:#0000BB'>$fp</span></font></code><code><font size=2 color="#007700"
face="Courier New"><span style='font-size:10.0pt;color:#007700'>);</span></font></code><font
size=2 color="#007700" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#007700'><br>
<code><font face="Courier New">}</font></code><br>
</span></font><code><font size=2 color="#0000bb" face="Courier New"><span
style='font-size:10.0pt;color:#0000BB'>?></span></font></code><code><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;color:black'>
</span></font></code><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I would first try running that (put in
your host and port) and see what the error string coming back is.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div>
<div>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><font
size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'>-Justin<o:p></o:p></span></font></p>
</div>
</div>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> asterisk-users-bounces@lists.digium.com
[mailto:asterisk-users-bounces@lists.digium.com] <b><span style='font-weight:
bold'>On Behalf Of </span></b>Muhammad<br>
<b><span style='font-weight:bold'>Sent:</span></b> Monday, February 04, 2013
5:07 AM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Asterisk
Users Mailing List - Non-Commercial Discussion</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> [asterisk-users] problem
to socket programming in AGI</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Hi,<br>
I know maybe this question is not related to asterisk, but I want to make XML
RPC web service to other http server.<br>
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).<br>
<br>
what is the problem. is this related to elastix(asterisk) server?<o:p></o:p></span></font></p>
</div>
</div>
</body>
</html>