A "webpage" is a file, that (usually) a browser downloads and parses. You'll do exactly the same :-) I don't know exactly, but you can try to pass the URL directly to simplexml_load_file(). If this doesn't work, download the content (for example with file_get_contents()) and pass it to simplexml_load_string(). There are obviously many other approaches, but you should now have an idea :-) Or you use a specialized library like Guzzle. Am 19.04.2013 22:17 schrieb "dealTek" <dealtek@xxxxxxxxx>: > Hi all, > > newbie - just starting with trying to parse XML... > > > $mylist = simplexml_load_file('thelist.xml'); > > then use a foreach to echo the data... > > <?php > $mysongs = simplexml_load_file('songs.xml'); > > foreach ($mysongs as $songinfo) { > $title=$songinfo->title; > $artist=$songinfo->artist; > $date=$songinfo['dateplayed']; > echo $title.' --- '; > echo $artist.' --- '; > echo $date.' --- '; > echo ' </br> '; > } > > ?> > > that I get ... > > Question: how do you use $mylist when the xml is not as a file but is > returned on a web page? > > > an example of the real xml I am trying to work with is like this demo > below .... > > Goal : when this response comes back - I would like to be able to get the > data as php and then update the database.... > > > example........ > <?xml version="1.0" encoding="UTF-8"?> > <response> > <result>1</result> > <result-text>SUCCESS</result-text> > <transaction-id>1865264174</transaction-id> > <result-code>100</result-code> > <authorization-code>123456</authorization-code> > <avs-result>N</avs-result> > <cvv-result>N</cvv-result> > <action-type>sale</action-type> > <amount>12.00</amount> > <ip-address>::1</ip-address> > <industry>ecommerce</industry> > <processor-id>ccprocessora</processor-id> > <currency>USD</currency> > <order-description>Small Order</order-description> > <merchant-defined-field-1>Red</merchant-defined-field-1> > <merchant-defined-field-2>Medium</merchant-defined-field-2> > <order-id>1234</order-id> > <tax-amount>2.00</tax-amount> > <shipping-amount>0.00</shipping-amount> > <billing> > <first-name>John</first-name> > <last-name>Smith</last-name> > <address1>1234 Main St.</address1> > <city>Beverly Hills</city> > <state>CA</state> > <postal>90210</postal> > <country>US</country> > <phone>555-555-5555</phone> > <email>test@xxxxxxxxxxx</email> > <company>Acme, Inc.</company> > <cc-number>400000******0002</cc-number> > <cc-exp>0118</cc-exp> > </billing> > <shipping> > <first-name>Mary</first-name> > <last-name>Smith</last-name> > <address1>1234 Main St.</address1> > <city>Beverly Hills</city> > <state>CA</state> > <postal>90210</postal> > <country>US</country> > <address2>Unit #2</address2> > </shipping> > <product> > <product-code>SKU-123456</product-code> > <description>test product description</description> > <commodity-code>abc</commodity-code> > <unit-of-measure>1</unit-of-measure> > <unit-cost>5.0000</unit-cost> > <quantity>1.0000</quantity> > <total-amount>7.00</total-amount> > <tax-amount>2.00</tax-amount> > <tax-rate>1.00</tax-rate> > <discount-amount>2.00</discount-amount> > <discount-rate>1.00</discount-rate> > <tax-type>sales</tax-type> > <alternate-tax-id>12345</alternate-tax-id> > </product> > <product> > <product-code>SKU-123456</product-code> > <description>test 2 product description</description> > <commodity-code>abc</commodity-code> > <unit-of-measure>2</unit-of-measure> > <unit-cost>2.5000</unit-cost> > <quantity>2.0000</quantity> > <total-amount>7.00</total-amount> > <tax-amount>2.00</tax-amount> > <tax-rate>1.00</tax-rate> > <discount-amount>2.00</discount-amount> > <discount-rate>1.00</discount-rate> > <tax-type>sales</tax-type> > <alternate-tax-id>12345</alternate-tax-id> > </product> > </response> > > > > > > > > > -- > Thanks, > Dave - DealTek > dealtek@xxxxxxxxx > [db-3] > >