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

<?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

    How are you retreiving the content? Depending upon which method you're using to get the XML data, you can probably change an option so that you only get the actual data.

    Otherwise, you could probably do something like this:

    $data = preg_replace('/.*?\r\n\r\n(.*)/s', '$1', $data);
    
    // OR
    
    $data = substr_replace($data, '', 0, strpos($data, "\r\n\r\n")+4);

      this is how i send request and get teh content back:
      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

      <?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!!!

        this is how i send and retreiue the contents:<?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: 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>";

        any idea wht i can do ...

          smilesmita wrote:

          any idea wht i can do ...

          Yeah - either use the code example I posted above, or use [man]cURL[/man] and set the CURLOPT_HEADER option to FALSE.

            Write a Reply...