[SOLVED] PEAR::SOAP
Moderator: General Moderators
-
chocolatetoothpaste
- Forum Newbie
- Posts: 10
- Joined: Wed Sep 06, 2006 10:48 am
[SOLVED] PEAR::SOAP
I need some help really bad. I am using pear::soap to connect to a webservice. I am connecting fine and receiving a proper response. The problem is I don't know how to parse that data into a usable php array. I need to be able to manipulate and format that data to display it on a website. I am not dead set on pear::soap, that is just what I have been using. If you can suggest something else I would use it. I don't like nusoap too much, and XML_RPC hasn't been working properly. Please any help you can give, thanks.
Last edited by chocolatetoothpaste on Tue Sep 12, 2006 11:16 am, edited 1 time in total.
-
chocolatetoothpaste
- Forum Newbie
- Posts: 10
- Joined: Wed Sep 06, 2006 10:48 am
feyd | Please use
The stars are the address, username, and password respectively. SO anyway, when I do print_r(), it looks a little like this:
etc, etc.
Is there something wrong with my script?
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]
When I use print_r(), it just spits out the data but not the xml tags. when I save the response to a file, the file still has all of the xml in place. This is what my script looks like:Code: Select all
<?php
require_once 'SOAP/Client.php';
$wsdl = new SOAP_WSDL('******');
$client = $wsdl->getProxy();
$result = $client->GetLeadsByDate('******', '******','2006-07-01','2006-07-09');
?><div align="left"><pre><?php print_r($result); ?></pre></div><?php
?>Code: Select all
TrueCall was successful
6539811UT: Salt Lake City (All)1415626 S 1915 ECottonwoodUT84121USANewspaper07-03-200607-04-2006(801) 424-2188Do Not Call RegistryTrue5646 Nations WAYSalt Lake CityUT84121UnitedStatesKurtLarsen2.7540.24 Acre_265000UnknownHomeYesYesYesYes
6551434UT: Salt Lake City (All)141DraperUt84020USANewspaper07-05-200607-06-2006(801) 654-3826FalseSalt Lake CityUTUnitedStates2.0040.29 Acre259900Multi-LevelHomeYesYesYes
6539818UT: Salt Lake City (All)141East MillcreekUTUSANewspaper07-03-200607-04-2006(801) 859-7683FalseSalt Lake CityUTUnitedStates2.503_329900UnknownHomeYesBackyardYesYesIs there something wrong with my script?
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]-
chocolatetoothpaste
- Forum Newbie
- Posts: 10
- Joined: Wed Sep 06, 2006 10:48 am
Re: PEAR::SOAP
That was the intent of the original post. I don't know how to pass it to a parser. Does PEAR::SOAP have a parser, or are there some other functions or classes I can pass it to?chocolatetoothpaste wrote:The problem is I don't know how to parse that data into a usable php array. I need to be able to manipulate and format that data to display it on a website.
If you're using PHP5, you can check out simple_xml to parse your xml
You would use it something like this
You would use it something like this
Code: Select all
$xml = new SimpleXMLElement($result);
echo $xml->node_name_in_your_xml[0]->element;- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
-
chocolatetoothpaste
- Forum Newbie
- Posts: 10
- Joined: Wed Sep 06, 2006 10:48 am
I am using php 4. Does anyone have any ideas for parsing in php 4?
Here is the xml I need to parse:
Here is the xml I need to parse:
Code: Select all
<result><success>True</success><message>Call was successful</message><data><Listings><Listing><id>6509880</id><AreaName>UT: Ogden (All)</AreaName><AreaId>157</AreaId><Street>3075 Polk</Street><City>Ogden</City><Locality>UT</Locality><PostalCode>84403</PostalCode><Country>USA</Country><SourceName>Newspaper</SourceName><ListingDate>07-01-2006</ListingDate><DeliveryDate>07-02-2006</DeliveryDate><Contacts><Contact><PhoneNumber>(801) 621-8017</PhoneNumber><IsOnDNC>False</IsOnDNC><Street>3075 Polk AVE</Street><City>Ogden</City><Locality>UT</Locality><PostalCode>84403</PostalCode><Country>UnitedStates</Country><FirstName>Philip</FirstName><LastName>Boyer</LastName></Contact><Contact><PhoneNumber>(801) 391-8300</PhoneNumber><IsOnDNC>False</IsOnDNC><City>Ogden</City><Locality>UT</Locality><Country>UnitedStates</Country></Contact></Contacts><DataValues><dv Name="Bathrooms">2.00</dv><dv Name="Bedrooms">4</dv><dv Name="Lot Size">.22Acre_</dv><dv Name="Price">184900</dv><dv Name="Property Style">Rambler</dv><dv Name="Property Type">Home</dv><dv Name="Fence">Yes</dv><dv Name="Fence Info">Backyard</dv></DataValues></Listing><Listing><id>6509929</id><AreaName>UT: Ogden (All)</AreaName><AreaId>157</AreaId><City>Ogden area</City><Locality>UT</Locality><Country>USA</Country><SourceName>Newspaper</SourceName><ListingDate>07-01-2006</ListingDate><DeliveryDate>07-02-2006</DeliveryDate><Contacts><Contact><PhoneNumber>(801) 336-6178</PhoneNumber><IsOnDNC>False</IsOnDNC><City>Kaysville</City><Locality>UT</Locality><Country>UnitedStates</Country></Contact></Contacts><DataValues><dv Name="Bathrooms">1.50</dv><dv Name="Bedrooms">3</dv><dv Name="Lot Size">_</dv><dv Name="Price">105999</dv><dv Name="Property Style">Unknown</dv><dv Name="Property Type">Home</dv><dv Name="Fence">Yes</dv><dv Name="Fence Info">Backyard</dv><dv Name="Garage">Yes</dv><dv Name="Garage Info">2</dv><dv Name="Family Room">Yes</dv><dv Name="Living Room">Yes</dv></DataValues></Listing><Listing><id>6513327</id><AreaName>UT: Logan (All)</AreaName><AreaId>168</AreaId><Street>350 W 880 N</Street><City>Logan</City><Locality>UT</Locality><PostalCode>84321</PostalCode><Country>USA</Country><SourceName>Newspaper</SourceName><ListingDate>07-01-2006</ListingDate><DeliveryDate>07-02-2006</DeliveryDate><Contacts><Contact><PhoneNumber>(435) 770-4224</PhoneNumber><IsOnDNC>False</IsOnDNC><City>Logan</City><Locality>UT</Locality><Country>UnitedStates</Country></Contact></Contacts><DataValues><dv Name="Bathrooms">2.00</dv><dv Name="Bedrooms">5</dv><dv Name="Lot Size">_</dv><dv Name="Price">156000</dv><dv Name="Property Style">Unknown</dv><dv Name="Property Type">Home</dv></DataValues></Listing><Listing><id>6513330</id><AreaName>UT: Logan (All)</AreaName><AreaId>168</AreaId><City>Smithfield</City><Locality>UT</Locality><PostalCode>84335</PostalCode><Country>USA</Country><SourceName>Newspaper</SourceName><ListingDate>07-01-2006</ListingDate><DeliveryDate>07-02-2006</DeliveryDate><Contacts><Contact><PhoneNumber>(435) 512-6933</PhoneNumber><IsOnDNC>False</IsOnDNC><City>Logan</City><Locality>UT</Locality><Country>UnitedStates</Country></Contact></Contacts><DataValues><dv Name="Price">72000</dv><dv Name="Property Style">Unknown</dv><dv Name="Property Type">Lot</dv></DataValues></Listing><Listing><id>6517396</id><AreaName>UT: Davis County (All)</AreaName><AreaId>176</AreaId><Street>2921 S 450Th W</Street><City>Bountiful</City><Locality>UT</Locality><PostalCode>84010</PostalCode><Country>USA</Country><SourceName>Newspaper</SourceName><ListingDate>07-01-2006</ListingDate><DeliveryDate>07-03-2006</DeliveryDate><Contacts><Contact><PhoneNumber>(801) 294-4597</PhoneNumber><DoNotCall>Do Not Call Registry</DoNotCall><IsOnDNC>True</IsOnDNC><Street>2921 S 450th W</Street><City>Bountiful</City><Locality>UT</Locality><PostalCode>84010</PostalCode><Country>UnitedStates</Country><FirstName>William C</FirstName><LastName>Hair</LastName></Contact><Contact><PhoneNumber>(801) 706-9780</PhoneNumber><DoNotCall>Do Not Call Registry</DoNotCall><IsOnDNC>True</IsOnDNC><City>Salt Lake City</City><Locality>UT</Locality><Country>UnitedStates</Country></Contact></Contacts><DataValues><dv Name="Bathrooms">3.00</dv><dv Name="Bedrooms">4</dv><dv Name="Lot Size">0.25 Acre</dv><dv Name="Price">260000</dv><dv Name="Property Style">Unknown</dv><dv Name="Property Type">Home</dv><dv Name="Jacuzzi">Yes</dv><dv Name="Open House">7/8 9-7</dv><dv Name="Open House Info">7/8 9-7</dv></DataValues></Listing><Listing><id>6517398</id><AreaName>UT: Davis County (All)</AreaName><AreaId>176</AreaId><City>Centerville</City><Locality>UT</Locality><PostalCode>84014</PostalCode><Country>USA</Country><SourceName>Newspaper</SourceName><ListingDate>07-01-2006</ListingDate><DeliveryDate>07-03-2006</DeliveryDate><Contacts><Contact><PhoneNumber>(801) 580-6739</PhoneNumber><IsOnDNC>False</IsOnDNC><City>Salt Lake City</City><Locality>UT</Locality><Country>UnitedStates</Country></Contact><Contact><PhoneNumber>(801) 499-1393</PhoneNumber><IsOnDNC>False</IsOnDNC><City>Kaysville</City><Locality>UT</Locality><Country>UnitedStates</Country></Contact></Contacts><DataValues><dv Name="Bathrooms">1.50</dv><dv Name="Bedrooms">3</dv><dv Name="Lot Size">_</dv><dv Name="Property Style">Unknown</dv><dv Name="Property Type">Home</dv><dv Name="Fireplace">Yes</dv></DataValues></Listing><Listing><id>6509915</id><AreaName>UT: Davis County (All)</AreaName><AreaId>176</AreaId><Street>2171 S 650 E</Street><City>Clearfield</City><Locality>UT</Locality><PostalCode>84015</PostalCode><Country>USA</Country><SourceName>Newspaper</SourceName><ListingDate>07-01-2006</ListingDate><DeliveryDate>07-02-2006</DeliveryDate><Contacts><Contact><PhoneNumber>(801) 603-5005</PhoneNumber><DoNotCall>Do Not Call Registry</DoNotCall><IsOnDNC>True</IsOnDNC><City>Ogden</City><Locality>UT</Locality><Country>UnitedStates</Country></Contact></Contacts><DataValues><dv Name="Bathrooms">4.00</dv><dv Name="Bedrooms">6</dv><dv Name="Price">319000</dv><dv Name="Property Style">Unknown</dv><dv Name="Property Type">Home</dv><dv Name="Fence">Yes</dv><dv Name="Garage">Yes</dv><dv Name="Garage Info">3</dv><dv Name="Parking">Yes</dv><dv Name="Parking Info">RV</dv><dv Name="Living Room">Yes</dv></DataValues></Listing></Listings></data></result>- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
-
chocolatetoothpaste
- Forum Newbie
- Posts: 10
- Joined: Wed Sep 06, 2006 10:48 am
[SOLVED] PEAR::SOAP
Excellent! That helped me get at least a temporary solution. Hopefully PEAR::SOAP finalizes a release and we get some better docs on the net. I wish I had the capacity to read the technical docs and figure it all out and be able to write a tut, but that is just not me. Thanks again!