D
designsimply
I am trying to http post some xml to to a remote server using php. When
I try to submit xml using PEAR's HTTP_Client:ost() to the remote
server, I get back the following "Invalid Document Format" error:
Array
(
I try to submit xml using PEAR's HTTP_Client:ost() to the remote
server, I get back the following "Invalid Document Format" error:
Array
(
Code:
=> 200
[headers] => Array
(
[Connection] => close
[connection] => close
[Server] => Microsoft-IIS/6.0
[server] => Microsoft-IIS/6.0
[X-Powered-By] => ASP.NET
[x-powered-by] => ASP.NET
[Content-Length] => 51
[content-length] => 51
[Content-Type] => text/html
[content-type] => text/html
[Cache-Control] => private, max-age=0
[cache-control] => private, max-age=0
[Date] => Mon, 16 May 2005 13:46:57 GMT
[date] => Mon, 16 May 2005 13:46:57 GMT
)
[body] => Invalid Document Format
Here is my php code:
// Variables
$url = "http://www.corporate-ir.net/ireye/xmlsub.asp";
$data = "<ALERT_SUBSCRIPTION>
<COMPANY CORPORATE_MASTER_ID="{valid id removed}">
<MEMBERS>
<MEMBER>
<EMAIL_ADDRESS>{valid email removed}</EMAIL_ADDRESS>
<ALERTS>
<ALERT SUBSCRIBE="YES">IR-NEWS</ALERT>
<ALERT SUBSCRIBE="YES">IR-EVENT</ALERT>
<ALERT SUBSCRIBE="YES">IR-SEC</ALERT>
<ALERT SUBSCRIBE="YES">IR-RPT</ALERT>
<ALERT SUBSCRIBE="YES">IR-MEDIA</ALERT>
</ALERTS>
</MEMBER>
</MEMBERS>
</COMPANY>
</ALERT_SUBSCRIPTION>";
// Send xml data to initiate email alert sign-up.
require_once('HTTP/Client.php');
$c =& new HTTP_Client();
$c->post('$url', $data');
$response = $c->currentResponse();
//echo $response['body'];
echo "<pre>"; print_r($response); echo "</pre>"; // easier to see full
response
Here is a VB example from the documentation I was given, but I am
trying to do it with php instead.
Dim xmlObj As MSXML2.XMLHTTP
Dim URL As String
Dim response As String
Dim xmlDoc As DOMDocument26
Set xmlObj = CreateObject("MSXML2.xmlhttp")
Set xmlDoc = New DOMDocument26
URL = "http://www.corporate-ir.net/ireye/xmlsub.asp"
xmlDoc.Load "C:\Documents and Settings\jdoe\Desktop\alert.xml"
xmlObj.open "POST", URL, False
xmlObj.send xmlDoc.xml
response = xmlObj.responseText 'view the value of response to see if
the post was successful
MsgBox "Done"
End Sub
Thank you very much for any help with this.