RE: [PHP] PHP, Soap, and WDSL
| From: | SBS Computers | Date: | Mon, 06 Sep 2010 20:23:47 +0000 |
| Subject: | RE: [PHP] PHP, Soap, and WDSL | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-307874@lists.php.net to get a copy of this message | ||
One more question. How would I parse the data below so that I only display the section ->
information="info_2"
I've read a few articles on xml name spaces and none have helped.
<?xml version="1.0" encoding="utf-16"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="http://nowhere.com/wsdl"><soap:Body><response
status="complete" version="46" resource_type="data_1"
ns="username" op_type="get_data">
<data_1 id="ID 1" information="info_2"/>
/response></soap:Body></soap:Envelope>
I tried the following which give me an error in "foreach"
$test2 = simplexml_load_file('file.xml')
or die("Error: Cannot create object");
$test = $test2->xpath('Envelope/Body/response/data_1/@information');
foreach($test as $test)
{
echo $test.PHP_EOL;
}
From: sbs_computers@hotmail.com
To: chris404@gmail.com; jangita@jangita.com
CC: php-general@lists.php.net
Subject: RE: [PHP] PHP, Soap, and WDSL
Date: Fri, 3 Sep 2010 09:05:52 -0400
Thanks guys.
Both methods worked.
Gino
> Date: Fri, 3 Sep 2010 08:31:06 -0400
> From: chris404@gmail.com
> To: jangita@jangita.com
> CC: php-general@lists.php.net
> Subject: Re: [PHP] PHP, Soap, and WDSL
>
> Alternatively you can pass the var through htmlspecialchars...
>
> echo htmlspecialchars( $response );
>
>
> and for a really simple solution you can echo it inside a textarea...
>
> echo "<textarea> $response </textarea>";
>
>
> Though you'll likely want to increase the size of the textarea! ;-)
>
>
>
>
> Chris.
>
>
>
> On Fri, Sep 3, 2010 at 3:39 AM, Jangita <jangita@jangita.com> wrote:
>
> > On 02/09/2010 10:51 p, SBS Computers wrote:
> >
> > It's as if the data is not getting to my php page?
> >>
> >> The view source shows the following data:
> >>
> >> <?xml version="1.0" encoding="utf-16"?><soap:Envelope
> >> xmlns:soap="
> >> http://schemas.xmlsoap.org/soap/envelope/">
> >> .
> >> .
> >> .bunch of data
> >> .
> >> .
> >> </response></soap:Body></soap:Envelope>
> >>
> >> Seems like the data is getting there OK. But a browser normally will not
> > output normal xml and hides it (unless there is a <body /> tag or other tags
> > that normally display output since it is using the text/html MIME
> >
> > add this line
> >
> > header('Content-type: text/plain');
> >
> > before the echo and see what happens. Also make sure there is no other
> > output (echo or any html tags) before the line above
> >
> > --
> > Jangita | +256 76 91 8383 | Y! & MSN: jangita@yahoo.com
> > Skype: jangita | GTalk: jangita.nyagudi@gmail.com
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >