This is what I was looking for. Thank you. I could not change the
client since that client is being used for other servers in its current
configuration. All I needed was a way to get to the XML string coming
in.
$postText = trim(file_get_contents('php://input');
worked perfectly. Now that I have this blob of XML I can give it to
simpleXML or another parser I was recently shown to work with it. I'm
surprised it was so difficult to find. $GLOBALS['HTTP_RAW_POST_DATA']
was empty by the way and that I'd seen before.
Also, sorry if I threw anyone off by referring to the other server the
client works with as an XML server. I only referred to it as such
because it is a server that accepts XML input and responds with XML
output to a number of clients. It is not used as a typical html server
for browsing etc.
Anyway, I was looking to get a hold of the raw data coming in and it
looks like this was it. I really do appreciate the help...
Larry
On Sat, 2008-03-01 at 22:06 -0500, Andrés Robinet wrote:
> You can get what you post either with:
>
> $postText = trim(file_get_contents('php://input');
>
> Or with:
>
> $postText = $GLOBALS["HTTP_RAW_POST_DATA"];
>
> About HTTP_RAW_POST_DATA http://us2.php.net/manual/en/reserved.variables.php
> Read the notes here http://us2.php.net/variables.predefined
>
> "It should be noted that $HTTP_RAW_POST_DATA only exists if the encoding type
> of
> the data is -not- the default of application/x-www.form-urlencoded, and so, to
> accessing raw post data from an HTTP form requires setting enctype= in your
> HTML. "
>
> So, if $RAW_POST_DATA doesn't exist, it is because you should be able to use
> $_POST (unless you set PHP to always populate raw post data in php.ini). The
> preferred method is, however, to read 'php://input'
>
> Then after you get the XML body, you must use one of the XML extensions
> available in PHP to parse the XML data (search for it as it's not part of this
> help pack ;) ).
>
> Regards,
>
> Rob(inet)
>
> Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
> 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
> TEL 954-607-4207 | FAX 954-337-2695 |
> Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace |
> Web: bestplace.biz | Web: seo-diy.com
>
> > -----Original Message-----
> > From: Larry Brown [mailto:[EMAIL PROTECTED]
> > Sent: Saturday, March 01, 2008 9:43 PM
> > To: Nathan Nobbe
> > Cc: php
> > Subject: Re: [PHP] reading incoming xml
> >
> > The incoming message to the server is:
> >
> > POST /vendorXML.html HTTP/1.0
> > MIME-Version: 1.0
> > Content-type: text/html
> > Content-length: 114
> > Content-transfer-encoding: text
> > Request-number: 1
> > Document-type: Request
> > Interface-Version: Test 1.4
> > Connection: close
> >
> > <?xml version="1.0" encoding="UTF-8"?><Data>vendorCompanyID</Data>
> >
> >
> > Larry
> >
> > On Sat, 2008-03-01 at 18:08 -0500, Nathan Nobbe wrote:
> >
> > > hmm, it looks to me like you want to post a bunch of raw data to the
> > > server. im not sure exactly how to do that w/ the php curl functions...
> > > everything ive seen uses CURLOPT_POSTFIELDS to supply an associative
> > array
> > > of data to be posted. in this case you could easily send you data across
> > by
> > > choosing a name for the index, something like 'postdata', anything will
> > do,
> > > then it will be accessible on the system youre posting to via
> > > $_POST['postdata'].
> > >
> > > also, inlooking at your usage of CURLOPT_CUSTOMREQUEST, i dont believe
> > youre
> > > using it correctly, i think youre just supposed to put a string
> > > representing the desired http method in there, so something like 'HEAD',
> > > 'PUT', or in this case 'POST'. then you would supply the data as i said
> > > earlier, using CURLOPT_POSTFIELDS. so in all, i think something like
> > this
> > > would work for you,
> > >
> >
> > >
> > >
> > > and also, in reading the warning about CURLOPT_CUSTOMREQUEST, you might
> > just
> > > go with CURLOPT_POST => true, since you arent using an obscure http
> > method.
> > > im not sure exactly how to determine if the server supports this method
> > or
> > > not. anyway, i found this in 'man curl_easy_setopt' (thats the manpage
> > for
> > > the c function php uses for the CURLOPT_CUSTOMREQUEST option).
> > >
> > > Many people have wrongly used this option to replace the
> > > entire request with their own, including multiple headers and POST
> > contents.
> > > While that might
> > > work in many cases, it will cause libcurl to send
> > invalid
> > > requests and it could possibly confuse the remote server badly. Use
> > > CURLOPT_POST and CUR-
> > > LOPT_POSTFIELDS to set POST data. Use CURLOPT_HTTPHEADER to
> > > replace or extend the set of headers sent by libcurl. Use
> > > CURLOPT_HTTP_VERSION to change
> > > HTTP version.
> > >
> > > -nathan
> > --
> > Larry Brown <[EMAIL PROTECTED]>
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
--
Larry Brown <[EMAIL PROTECTED]>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php