Awesome ,thanks guys,
i used:
Code: Select all
if (strpos($response, 'Status="0"') !== false) {
echo 'Authenticated';
}
which returns positive if the response i'm looking for is provided.
One more thing...
that post command works perfectly, i can push XML to the phone now with no issues...
i also want to be able to retrieve the phones information using an HTTP GET request...
this is the request sent when i browse to the phone with IE>..
+g'wvE{L@PE@PDlGET / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: en-gb
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; InfoPath.2; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Host: 192.168.1.5
Connection: Keep-Alive
How can i send the same request with PHP (or just get the same response)
I've tried:
Code: Select all
$ip = $_POST['IP'];
$post ="GET/ HTTP/1.1";
$post.="Host: $ip\r\n";
$post.="Connection: keep-alive";
but no joy, i get an error saying:
HTTP/1.1 405 Method Not Allowed
Allow: GET, HEAD, POST, PUT
Content-Length: 0
Server: Allegro-Software-RomPager/4.34
This is what I'm expecting in response:
Code: Select all
HTTP/1.1 200 OK
Content-Type: text/html
Date: Sun, 06 Sep 2009 14:53:30 GMT
Cache-Control: no-cache
Expires: Thu, 26 Oct 1995 00:00:00 GMT
Transfer-Encoding: chunked
Server: Allegro-Software-RomPager/4.34
59e
<HTML>
<HEAD><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><TITLE>Cisco Systems, Inc.</TITLE>
</HEAD><BODY bgcolor="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" text="#003031"><TABLE BORDER="1" WIDTH="100%" HEIGHT="100%" CELLSPACING="0" CELLPADDING="0" bordercolor="#003031"><TR>
<td WIDTH="200" HEIGHT="100" ALIGN=center><A HREF="http://www.cisco.com"><IMG SRC="/FS/Logo.png"></A></TD><td HEIGHT="50" bgcolor="#003031"><p ALIGN=center><B><font color="#FFFFFF" size="6">Device Information</FONT></B><p ALIGN=center><B><font color="#FFFFFF" size="4">Cisco Unified IP Phone CP-7970G ( SEP00152B036727 )</FONT></FONT></B></TD>
</TR>
<TR><td WIDTH="200" ALIGN=center VALIGN=top bgcolor="#003031"><TABLE BORDER="0" CELLSPACING="10" CELLPADDING="0"><TR>
<TD><a href="/CGI/Java/Serviceability?adapter=device.statistics.device">Device Information</A></TD></TR>
<TR>
<TD><a href="/CGI/Java/Serviceability?adapter=device.statistics.configuration">Network Configuration</A></TD></TR>
<TR><TD><B><font color='#FFFFFF'>Network Statistics</FONT></B></TD></TR><TR>
<TD> <a href="/CGI/Java/Serviceability?adapter=device.statistics.ethernet">Ethernet Information</A></TD>
</TR><TR><TD> <a href="/CGI/Java/Serviceability?adapter=device.statistics.port.access">Access</A></TD></TR><TR><TD> <a href="/CGI/Java/Serviceability?adapter=device.statistics.port.network">Netwo
59e
rk</A></TD></TR><TR><TD><B><font color='#FFFFFF'>Device Logs</FONT></B></TD></TR><TR>
<TD> <a href="/CGI/Java/Serviceability?adapter=device.statistics.consolelog">Console Logs</A></TD><TR>
<TD> <a href="/CGI/Java/Serviceability?adapter=device.statistics.coredumps">Core Dumps</A></TD><TR>
<TD> <a href="/CGI/Java/Serviceability?adapter=device.settings.status.messages">Status Messages</A></TD></TR>
<TR>
<TD> <a href="/CGI/Java/Serviceability?adapter=device.trace.display.alarm">Debug Display</A></TD></TR>
<TR><TD><B><font color='#FFFFFF'>Streaming Statistics</FONT></B></TD></TR><TR><TD> <a href="/CGI/Java/Serviceability?adapter=device.statistics.streaming.0">Stream 1 </A></TD></TR><TR><TD> <a href="/CGI/Java/Serviceability?adapter=device.statistics.streaming.1">Stream 2 </A></TD></TR><TR><TD> <a href="/CGI/Java/Serviceability?adapter=device.statistics.streaming.2">Stream 3 </A></TD></TR><TR><TD> <a href="/CGI/Java/Serviceability?adapter=device.statistics.streaming.3">Stream 4 </A></TD></TR><TR><TD> <a href="/CGI/Java/Serviceability?adapter=device.statistics.streaming.4">Stream 5 </A></TD></TR></TABLE>
</TD>
<td VALIGN=top><DIV ALIGN=center>
<TABLE BORDER="0" CELLSPACING="10" CELLPADDING="0"><TR><TD><B> MAC Address</B></TD><td width=20></TD><TD><B>00152B036727</B></TD><
59e
/TR><TR><TD><B> Host Name</B></TD><td width=20></TD><TD><B>SEP00152B036727</B></TD></TR><TR><TD><B> Phone DN</B></TD><td width=20></TD><TD><B>10014535</B></TD></TR><TR><TD><B> App Load ID</B></TD><td width=20></TD><TD><B>jar70sccp.8-4-1ES10.sbn</B></TD></TR><TR><TD><B> Boot Load ID</B></TD><td width=20></TD><TD><B>7970_64060118.bin</B></TD></TR><TR><TD><B> Version</B></TD><td width=20></TD><TD><B>SCCP70.8-4-1SR2S</B></TD></TR><TR><TD><B> Expansion Module 1</B></TD><td width=20></TD><TD><B></B></TD></TR><TR><TD><B> Expansion Module 2</B></TD><td width=20></TD><TD><B></B></TD></TR><TR><TD><B> Hardware Revision</B></TD><td width=20></TD><TD><B>1.1</B></TD></TR><TR><TD><B> Serial Number</B></TD><td width=20></TD><TD><B>INM09321ZK9</B></TD></TR><TR><TD><B> Model Number</B></TD><td width=20></TD><TD><B>CP-7970G</B></TD></TR><TR><TD><B> Message Waiting</B></TD><td width=20></TD><TD><B>Yes</B></TD></TR><TR><TD><B> UDI</B></TD><td width=20></TD><TD><B>phone</B></TD></TR><TR><TD><B> </B></TD><td width=20></TD><TD><B>Cisco Unified IP Phone 7970G, Global</B></TD></TR><TR><TD><B> </B></TD><td width=20></TD><TD><B>CP-7970G</B></TD></TR><TR><TD><B> </B></TD><td width=20></TD><TD><B></B></TD></TR><TR><TD><B> </B></TD><td width=20></TD><TD><B>INM09321ZK9</B></TD></TR><TR><TD><B> Time</B></TD><td width=20></TD><TD><B>15:53:30</B></TD></TR><TR><TD><B> Time Zone</B></TD><td width=20></TD><TD><B>GMT Standard/Daylight Time</B></TD></TR>
076
<TR><TD><B> Date</B></TD><td width=20></TD><TD><B>06/09/09</B></TD></TR></TABLE></DIV></TD></TR></TABLE></BODY></HTML>
0