How to Remove Http header xml stream

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
smilesmita
Forum Commoner
Posts: 30
Joined: Thu May 24, 2007 1:52 pm

How to Remove Http header xml stream

Post by smilesmita »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


hi there,

I have this XML stream which i get from ups servers.looks like this:[i have shown xml stream as an example..please ignore the error tags it is shwoing right now]
HTTP/1.1 200 OK Date: Wed, 25 Jul 2007 20:37:04 GMT
Server: Apache/2.0.52 (Red Hat) mod_ssl/2.0.52 OpenSSL/0.9.7a
Pragma: no-cache
Content-Length: 480
Connection: close
Content-Type: application/xml

[syntax="xml"]<?xml version="1.0"?>
<QuantumViewResponse>
<Response>
<TransactionReference>
<CustomerContext>Test XML</CustomerContext>
<XpciVersion>1.0007</XpciVersion>
</TransactionReference>
<ResponseStatusCode>0</ResponseStatusCode>
<ResponseStatusDescription>Failure</ResponseStatusDescription>
<Error><ErrorSeverity>Hard</ErrorSeverity>
<ErrorCode>330026</ErrorCode>
<ErrorDescription>There are no unread files for the given Subscriber ID.</ErrorDescription></Error>
</Response>
</QuantumViewResponse>
I wanted to know if i there is a way to seperate the http header from the rest part..because i need an pure xml stream to pass to my array .i would like to therefore exclude the following part from the above stream,having the rest to be passed or used for further work.

HTTP/1.1 200 OK Date: Wed, 25 Jul 2007 20:37:04 GMT
Server: Apache/2.0.52 (Red Hat) mod_ssl/2.0.52 OpenSSL/0.9.7a
Pragma: no-cache
Content-Length: 480
Connection: close
Content-Type: application/xml

any idea??
Please help!!!

-smita


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

How do you send and receive the data?
smilesmita
Forum Commoner
Posts: 30
Joined: Thu May 24, 2007 1:52 pm

Post by smilesmita »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


hi

i am sending and getting the XML from ups server in this format:

Code: Select all

<?php

$fp =@fsockopen("ssl://www.ups.com",443, $errno, $errstr);
//echo $fp;
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else 

$upstr  = "POST /ups.app/xml/QVEvents HTTP/1.0\r\n";
$upstr .= "Host: http://www.ups.com\r\n";
$upstr .= "Content-Type: application/xml\r\n";
$upstr .= "Content-Length: 512\r\n\r\n";

$upstr .= '<?xml version="1.0"?>
<AccessRequest xml:lang="en-US">
<AccessLicenseNumber>XXXXX</AccessLicenseNumber>
<UserId>XXXX</UserId>
<Password>XXXX</Password>
</AccessRequest>
<?xml version="1.0" encoding="UTF-8"?>
<QuantumViewRequest xml:lang="en-US">
<Request>
<TransactionReference>
<CustomerContext>Test XML</CustomerContext>
<XpciVersion>1.0007</XpciVersion>
</TransactionReference>
<RequestAction>QVEvents</RequestAction>
</Request>
</QuantumViewRequest>';

fputs($fp,$upstr,strlen($upstr)); 




 while (!feof($fp)) {
        $soap_in .= fgets($fp,100);
        

fclose($fp);

}
echo "<xmp>$soap_in</xmp>";

So in this way i get the xml stream back from ups whichhas the http headers too..which i need to get rid of because i need to further conver this xml into array and extract data frm that array and put it in Database and further display that data peridically on our system.

Help!!!

Thanks
smita


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Post Reply