Jump to content
hungryfrank

problem with parsing xml

Recommended Posts

i am having problem with parsing an xml file . i am only getting the first result


$results = new SimpleXMLElement($responseXml); 
if ($results->Ack == "Success")
				{	

$this_temp_array = $results->Messages;
foreach ($this_temp_array as $key => $value)
						{
							if ($key == $n)
							$Message = $value;
							//print_r ($Message);
                    $MessageID = $Message->Message->MessageID;				

$n=$n+1;
echo $MessageID;
}

}

i get only the first MessageID and not the other four. here is the result from print

SimpleXMLElement Object
(
    [Message] => Array
        (
            [0] => SimpleXMLElement Object
                (
                    [Sender] => lindsayb*
                    [SendingUserID] => 1029058233
                    [RecipientUserID] => frank1002us
                    [SendToName] => frank1002us
                    [Subject] => lindsayb* has sent a message
                    [MessageID] => 82766201577
                    [ExternalMessageID] => 1391854322013
                    [Flagged] => false
                    [Read] => true
                    [ReceiveDate] => 2016-11-01T19:54:41.000Z
                    [ExpirationDate] => 2017-11-01T19:54:41.000Z
                    [ResponseDetails] => SimpleXMLElement Object
                        (
                            [ResponseEnabled] => true
                            [ResponseURL] => http://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&requested=lindsayb*&qid=1391854322013&redirect=0&messageid=m82766201577
                            [UserResponseDate] => 2016-11-01T22:25:27.000Z
                        )

                    [Folder] => SimpleXMLElement Object
                        (
                            [FolderID] => 0
                        )

                    [MessageType] => ContactEbayMember
                    [Replied] => true
                )

            [1] => SimpleXMLElement Object
                (
                    [Sender] => mountain_gear_trade
                    [SendingUserID] => 38786549
                    [RecipientUserID] => frank1002us
                    [SendToName] => frank1002us
                    [Subject] => Other: mountain_gear_trade sent a message about  Miele S7580 Bolero Upright HEPA Vacuum Cleaners #252606124491
                    [MessageID] => 82713809857
                    [ExternalMessageID] => 1381187481019
                    [Flagged] => false
                    [Read] => true
                    [ReceiveDate] => 2016-10-31T02:36:28.000Z
                    [ExpirationDate] => 2017-10-31T02:36:28.000Z
                    [ItemID] => 252606124491
                    [ResponseDetails] => SimpleXMLElement Object
                        (
                            [ResponseEnabled] => true
                            [ResponseURL] => http://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&item=252606124491&requested=mountain_gear_trade&qid=1381187481019&redirect=0&messageid=m82713809857
                            [UserResponseDate] => 2016-10-31T11:48:00.000Z
                        )

                    [Folder] => SimpleXMLElement Object
                        (
                            [FolderID] => 0
                        )

                    [MessageType] => AskSellerQuestion
                    [Replied] => true
                    [ItemEndTime] => 2016-11-02T18:52:48.000Z
                    [ItemTitle] =>  Miele S7580 Bolero Upright HEPA Vacuum Cleaners
                )

            [2] => SimpleXMLElement Object
                (
                    [Sender] => gzanf92
                    [SendingUserID] => 901529120
                    [RecipientUserID] => frank1002us
                    [SendToName] => frank1002us
                    [Subject] => Re: Details about item: gzanf92 sent a message about  Miele S7580 Bolero Upright HEPA Vacuum Cleaners #252606124491
                    [MessageID] => 82678997647
                    [ExternalMessageID] => 1395267626010
                    [Flagged] => false
                    [Read] => true
                    [ReceiveDate] => 2016-10-28T23:22:37.000Z
                    [ExpirationDate] => 2017-10-28T23:22:37.000Z
                    [ItemID] => 252606124491
                    [ResponseDetails] => SimpleXMLElement Object
                        (
                            [ResponseEnabled] => true
                            [ResponseURL] => http://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&item=252606124491&requested=gzanf92&qid=1395267626010&redirect=0&messageid=m82678997647
                            [UserResponseDate] => 2016-10-29T14:31:01.000Z
                        )

                    [Folder] => SimpleXMLElement Object
                        (
                            [FolderID] => 0
                        )

                    [MessageType] => ResponseToASQQuestion
                    [Replied] => true
                    [ItemEndTime] => 2016-11-02T18:52:48.000Z
                    [ItemTitle] =>  Miele S7580 Bolero Upright HEPA Vacuum Cleaners
                )

            [3] => SimpleXMLElement Object
                (
                    [Sender] => rjweber11777
                    [SendingUserID] => 1106628674
                    [RecipientUserID] => frank1002us
                    [SendToName] => frank1002us
                    [Subject] => rjweber11777 has sent a question about item #252556772355, that ended on Oct-02-16 17:37:47 PDT - electrolux epic 6500 SR Vacuum Cleaner Canister aerus
                    [MessageID] => 82656600697
                    [ExternalMessageID] => 1385568368014
                    [Flagged] => false
                    [Read] => true
                    [ReceiveDate] => 2016-10-28T00:41:34.000Z
                    [ExpirationDate] => 2017-10-28T00:41:34.000Z
                    [ItemID] => 252556772355
                    [ResponseDetails] => SimpleXMLElement Object
                        (
                            [ResponseEnabled] => true
                            [ResponseURL] => http://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&item=252556772355&requested=rjweber11777&qid=1385568368014&redirect=0&messageid=m82656600697
                        )

                    [Folder] => SimpleXMLElement Object
                        (
                            [FolderID] => 0
                        )

                    [MessageType] => AskSellerQuestion
                    [ListingStatus] => Ended
                    [Replied] => false
                    [ItemEndTime] => 2016-10-03T00:37:47.000Z
                    [ItemTitle] => electrolux epic 6500 SR Vacuum Cleaner Canister aerus
                )

            [4] => SimpleXMLElement Object
                (
                    [Sender] => rjweber11777
                    [SendingUserID] => 1106628674
                    [RecipientUserID] => frank1002us
                    [SendToName] => frank1002us
                    [Subject] => rjweber11777 has sent a question about item #252556772355, that ended on Oct-02-16 17:37:47 PDT - electrolux epic 6500 SR Vacuum Cleaner Canister aerus
                    [MessageID] => 82656600067
                    [ExternalMessageID] => 1385568359014
                    [Flagged] => false
                    [Read] => true
                    [ReceiveDate] => 2016-10-28T00:41:31.000Z
                    [ExpirationDate] => 2017-10-28T00:41:31.000Z
                    [ItemID] => 252556772355
                    [ResponseDetails] => SimpleXMLElement Object
                        (
                            [ResponseEnabled] => true
                            [ResponseURL] => http://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&item=252556772355&requested=rjweber11777&qid=1385568359014&redirect=0&messageid=m82656600067
                            [UserResponseDate] => 2016-10-28T22:03:49.000Z
                        )

                    [Folder] => SimpleXMLElement Object
                        (
                            [FolderID] => 0
                        )

                    [MessageType] => AskSellerQuestion
                    [ListingStatus] => Ended
                    [Replied] => true
                    [ItemEndTime] => 2016-10-03T00:37:47.000Z
                    [ItemTitle] => electrolux epic 6500 SR Vacuum Cleaner Canister aerus
                )

        )

)
82766201577

Share this post


Link to post
Share on other sites
SimpleXMLElement Object
(
    [Timestamp] => 2016-11-06T17:53:38.897Z
    [Ack] => Success
    [Version] => 963
    [Build] => E963_CORE_APIMSG_17909225_R1
    [Messages] => SimpleXMLElement Object
        (
            [Message] => Array
                (
                    [0] => SimpleXMLElement Object
                        (
                            [Sender] => lindsayb*
                            [SendingUserID] => 1029058233
                            [RecipientUserID] => frank1002us
                            [SendToName] => frank1002us
                            [Subject] => lindsayb* has sent a message
                            [MessageID] => 82766201577
                            [ExternalMessageID] => 1391854322013
                            [Flagged] => false
                            [Read] => true
                            [ReceiveDate] => 2016-11-01T19:54:41.000Z
                            [ExpirationDate] => 2017-11-01T19:54:41.000Z
                            [ResponseDetails] => SimpleXMLElement Object
                                (
                                    [ResponseEnabled] => true
                                    [ResponseURL] => http://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&requested=lindsayb*&qid=1391854322013&redirect=0&messageid=m82766201577
                                    [UserResponseDate] => 2016-11-01T22:25:27.000Z
                                )

                            [Folder] => SimpleXMLElement Object
                                (
                                    [FolderID] => 0
                                )

                            [MessageType] => ContactEbayMember
                            [Replied] => true
                        )

                    [1] => SimpleXMLElement Object
                        (
                            [Sender] => mountain_gear_trade
                            [SendingUserID] => 38786549
                            [RecipientUserID] => frank1002us
                            [SendToName] => frank1002us
                            [Subject] => Other: mountain_gear_trade sent a message about  Miele S7580 Bolero Upright HEPA Vacuum Cleaners #252606124491
                            [MessageID] => 82713809857
                            [ExternalMessageID] => 1381187481019
                            [Flagged] => false
                            [Read] => true
                            [ReceiveDate] => 2016-10-31T02:36:28.000Z
                            [ExpirationDate] => 2017-10-31T02:36:28.000Z
                            [ItemID] => 252606124491
                            [ResponseDetails] => SimpleXMLElement Object
                                (
                                    [ResponseEnabled] => true
                                    [ResponseURL] => http://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&item=252606124491&requested=mountain_gear_trade&qid=1381187481019&redirect=0&messageid=m82713809857
                                    [UserResponseDate] => 2016-10-31T11:48:00.000Z
                                )

                            [Folder] => SimpleXMLElement Object
                                (
                                    [FolderID] => 0
                                )

                            [MessageType] => AskSellerQuestion
                            [Replied] => true
                            [ItemEndTime] => 2016-11-02T18:52:48.000Z
                            [ItemTitle] =>  Miele S7580 Bolero Upright HEPA Vacuum Cleaners
                        )

                    [2] => SimpleXMLElement Object
                        (
                            [Sender] => gzanf92
                            [SendingUserID] => 901529120
                            [RecipientUserID] => frank1002us
                            [SendToName] => frank1002us
                            [Subject] => Re: Details about item: gzanf92 sent a message about  Miele S7580 Bolero Upright HEPA Vacuum Cleaners #252606124491
                            [MessageID] => 82678997647
                            [ExternalMessageID] => 1395267626010
                            [Flagged] => false
                            [Read] => true
                            [ReceiveDate] => 2016-10-28T23:22:37.000Z
                            [ExpirationDate] => 2017-10-28T23:22:37.000Z
                            [ItemID] => 252606124491
                            [ResponseDetails] => SimpleXMLElement Object
                                (
                                    [ResponseEnabled] => true
                                    [ResponseURL] => http://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&item=252606124491&requested=gzanf92&qid=1395267626010&redirect=0&messageid=m82678997647
                                    [UserResponseDate] => 2016-10-29T14:31:01.000Z
                                )

                            [Folder] => SimpleXMLElement Object
                                (
                                    [FolderID] => 0
                                )

                            [MessageType] => ResponseToASQQuestion
                            [Replied] => true
                            [ItemEndTime] => 2016-11-02T18:52:48.000Z
                            [ItemTitle] =>  Miele S7580 Bolero Upright HEPA Vacuum Cleaners
                        )

                    [3] => SimpleXMLElement Object
                        (
                            [Sender] => rjweber11777
                            [SendingUserID] => 1106628674
                            [RecipientUserID] => frank1002us
                            [SendToName] => frank1002us
                            [Subject] => rjweber11777 has sent a question about item #252556772355, that ended on Oct-02-16 17:37:47 PDT - electrolux epic 6500 SR Vacuum Cleaner Canister aerus
                            [MessageID] => 82656600697
                            [ExternalMessageID] => 1385568368014
                            [Flagged] => false
                            [Read] => true
                            [ReceiveDate] => 2016-10-28T00:41:34.000Z
                            [ExpirationDate] => 2017-10-28T00:41:34.000Z
                            [ItemID] => 252556772355
                            [ResponseDetails] => SimpleXMLElement Object
                                (
                                    [ResponseEnabled] => true
                                    [ResponseURL] => http://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&item=252556772355&requested=rjweber11777&qid=1385568368014&redirect=0&messageid=m82656600697
                                )

                            [Folder] => SimpleXMLElement Object
                                (
                                    [FolderID] => 0
                                )

                            [MessageType] => AskSellerQuestion
                            [ListingStatus] => Ended
                            [Replied] => false
                            [ItemEndTime] => 2016-10-03T00:37:47.000Z
                            [ItemTitle] => electrolux epic 6500 SR Vacuum Cleaner Canister aerus
                        )

                    [4] => SimpleXMLElement Object
                        (
                            [Sender] => rjweber11777
                            [SendingUserID] => 1106628674
                            [RecipientUserID] => frank1002us
                            [SendToName] => frank1002us
                            [Subject] => rjweber11777 has sent a question about item #252556772355, that ended on Oct-02-16 17:37:47 PDT - electrolux epic 6500 SR Vacuum Cleaner Canister aerus
                            [MessageID] => 82656600067
                            [ExternalMessageID] => 1385568359014
                            [Flagged] => false
                            [Read] => true
                            [ReceiveDate] => 2016-10-28T00:41:31.000Z
                            [ExpirationDate] => 2017-10-28T00:41:31.000Z
                            [ItemID] => 252556772355
                            [ResponseDetails] => SimpleXMLElement Object
                                (
                                    [ResponseEnabled] => true
                                    [ResponseURL] => http://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&item=252556772355&requested=rjweber11777&qid=1385568359014&redirect=0&messageid=m82656600067
                                    [UserResponseDate] => 2016-10-28T22:03:49.000Z
                                )

                            [Folder] => SimpleXMLElement Object
                                (
                                    [FolderID] => 0
                                )

                            [MessageType] => AskSellerQuestion
                            [ListingStatus] => Ended
                            [Replied] => true
                            [ItemEndTime] => 2016-10-03T00:37:47.000Z
                            [ItemTitle] => electrolux epic 6500 SR Vacuum Cleaner Canister aerus
                        )

                )

        )

)

i get it from Ebay api

i don't know how to get it in the original form but here is a link to the documantation

http://developer.ebay.com/devzone/xml/docs/Reference/eBay/GetMyMessages.html

Edited by hungryfrank

Share this post


Link to post
Share on other sites
$results = new SimpleXMLElement($responseXml); 

There's a good chance that it is in $responseXml

echo "<pre>$responseXml</pre>";

Share this post


Link to post
Share on other sites
2016-11-06T18:18:20.910ZSuccess963E963_CORE_APIMSG_17909225_R1lindsayb*1029058233frank1002usfrank1002uslindsayb* has sent a message827662015771391854322013falsetrue2016-11-01T19:54:41.000Z2017-11-01T19:54:41.000Ztruehttp://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&requested=lindsayb*&qid=1391854322013&redirect=0&messageid=m827662015772016-11-01T22:25:27.000Z0ContactEbayMembertruemountain_gear_trade38786549frank1002usfrank1002usOther: mountain_gear_trade sent a message about  Miele S7580 Bolero Upright HEPA Vacuum Cleaners #252606124491827138098571381187481019falsetrue2016-10-31T02:36:28.000Z2017-10-31T02:36:28.000Z252606124491truehttp://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&item=252606124491&requested=mountain_gear_trade&qid=1381187481019&redirect=0&messageid=m827138098572016-10-31T11:48:00.000Z0AskSellerQuestiontrue2016-11-02T18:52:48.000Z Miele S7580 Bolero Upright HEPA Vacuum Cleanersgzanf92901529120frank1002usfrank1002usRe: Details about item: gzanf92 sent a message about  Miele S7580 Bolero Upright HEPA Vacuum Cleaners #252606124491826789976471395267626010falsetrue2016-10-28T23:22:37.000Z2017-10-28T23:22:37.000Z252606124491truehttp://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&item=252606124491&requested=gzanf92&qid=1395267626010&redirect=0&messageid=m826789976472016-10-29T14:31:01.000Z0ResponseToASQQuestiontrue2016-11-02T18:52:48.000Z Miele S7580 Bolero Upright HEPA Vacuum Cleanersrjweber117771106628674frank1002usfrank1002usrjweber11777 has sent a question about item #252556772355, that ended on Oct-02-16 17:37:47 PDT - electrolux epic 6500 SR Vacuum Cleaner Canister aerus826566006971385568368014falsetrue2016-10-28T00:41:34.000Z2017-10-28T00:41:34.000Z252556772355truehttp://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&item=252556772355&requested=rjweber11777&qid=1385568368014&redirect=0&messageid=m826566006970AskSellerQuestionEndedfalse2016-10-03T00:37:47.000Zelectrolux epic 6500 SR Vacuum Cleaner Canister aerusrjweber117771106628674frank1002usfrank1002usrjweber11777 has sent a question about item #252556772355, that ended on Oct-02-16 17:37:47 PDT - electrolux epic 6500 SR Vacuum Cleaner Canister aerus826566000671385568359014falsetrue2016-10-28T00:41:31.000Z2017-10-28T00:41:31.000Z252556772355truehttp://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&item=252556772355&requested=rjweber11777&qid=1385568359014&redirect=0&messageid=m826566000672016-10-28T22:03:49.000Z0AskSellerQuestionEndedtrue2016-10-03T00:37:47.000Zelectrolux epic 6500 SR Vacuum Cleaner Canister aerus

wow i don't know if you can figure it or not? but i thank you for trying

Share this post


Link to post
Share on other sites

<?xml version="1.0" encoding="UTF-8"?>
<GetMyMessagesResponse xmlns="urn:ebay:apis:eBLBaseComponents"><Timestamp>2016-11-06T18:32:18.485Z</Timestamp><Ack>Success</Ack><Version>963</Version><Build>E963_CORE_APIMSG_17909225_R1</Build><Messages><Message><Sender>mountain_gear_trade</Sender><SendingUserID>38786549</SendingUserID><RecipientUserID>frank1002us</RecipientUserID><SendToName>frank1002us</SendToName><Subject>Other: mountain_gear_trade sent a message about Miele S7580 Bolero Upright HEPA Vacuum Cleaners #252606124491</Subject><MessageID>82713809857</MessageID><ExternalMessageID>1381187481019</ExternalMessageID><Flagged>false</Flagged><Read>true</Read><ReceiveDate>2016-10-31T02:36:28.000Z</ReceiveDate><ExpirationDate>2017-10-31T02:36:28.000Z</ExpirationDate><ItemID>252606124491</ItemID><ResponseDetails><ResponseEnabled>true</ResponseEnabled><ResponseURL>http://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&item=252606124491&requested=mountain_gear_trade&qid=1381187481019&redirect=0&messageid=m82713809857</ResponseURL><UserResponseDate>2016-10-31T11:48:00.000Z</UserResponseDate></ResponseDetails><Folder><FolderID>0</FolderID></Folder><MessageType>AskSellerQuestion</MessageType><Replied>true</Replied><ItemEndTime>2016-11-02T18:52:48.000Z</ItemEndTime><ItemTitle> Miele S7580 Bolero Upright HEPA Vacuum Cleaners</ItemTitle></Message><Message><Sender>gzanf92</Sender><SendingUserID>901529120</SendingUserID><RecipientUserID>frank1002us</RecipientUserID><SendToName>frank1002us</SendToName><Subject>Re: Details about item: gzanf92 sent a message about Miele S7580 Bolero Upright HEPA Vacuum Cleaners #252606124491</Subject><MessageID>82678997647</MessageID><ExternalMessageID>1395267626010</ExternalMessageID><Flagged>false</Flagged><Read>true</Read><ReceiveDate>2016-10-28T23:22:37.000Z</ReceiveDate><ExpirationDate>2017-10-28T23:22:37.000Z</ExpirationDate><ItemID>252606124491</ItemID><ResponseDetails><ResponseEnabled>true</ResponseEnabled><ResponseURL>http://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&item=252606124491&requested=gzanf92&qid=1395267626010&redirect=0&messageid=m82678997647</ResponseURL><UserResponseDate>2016-10-29T14:31:01.000Z</UserResponseDate></ResponseDetails><Folder><FolderID>0</FolderID></Folder><MessageType>ResponseToASQQuestion</MessageType><Replied>true</Replied><ItemEndTime>2016-11-02T18:52:48.000Z</ItemEndTime><ItemTitle> Miele S7580 Bolero Upright HEPA Vacuum Cleaners</ItemTitle></Message><Message><Sender>rjweber11777</Sender><SendingUserID>1106628674</SendingUserID><RecipientUserID>frank1002us</RecipientUserID><SendToName>frank1002us</SendToName><Subject>rjweber11777 has sent a question about item #252556772355, that ended on Oct-02-16 17:37:47 PDT - electrolux epic 6500 SR Vacuum Cleaner Canister aerus</Subject><MessageID>82656600697</MessageID><ExternalMessageID>1385568368014</ExternalMessageID><Flagged>false</Flagged><Read>true</Read><ReceiveDate>2016-10-28T00:41:34.000Z</ReceiveDate><ExpirationDate>2017-10-28T00:41:34.000Z</ExpirationDate><ItemID>252556772355</ItemID><ResponseDetails><ResponseEnabled>true</ResponseEnabled><ResponseURL>http://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&item=252556772355&requested=rjweber11777&qid=1385568368014&redirect=0&messageid=m82656600697</ResponseURL></ResponseDetails><Folder><FolderID>0</FolderID></Folder><MessageType>AskSellerQuestion</MessageType><ListingStatus>Ended</ListingStatus><Replied>false</Replied><ItemEndTime>2016-10-03T00:37:47.000Z</ItemEndTime><ItemTitle>electrolux epic 6500 SR Vacuum Cleaner Canister aerus</ItemTitle></Message><Message><Sender>rjweber11777</Sender><SendingUserID>1106628674</SendingUserID><RecipientUserID>frank1002us</RecipientUserID><SendToName>frank1002us</SendToName><Subject>rjweber11777 has sent a question about item #252556772355, that ended on Oct-02-16 17:37:47 PDT - electrolux epic 6500 SR Vacuum Cleaner Canister aerus</Subject><MessageID>82656600067</MessageID><ExternalMessageID>1385568359014</ExternalMessageID><Flagged>false</Flagged><Read>true</Read><ReceiveDate>2016-10-28T00:41:31.000Z</ReceiveDate><ExpirationDate>2017-10-28T00:41:31.000Z</ExpirationDate><ItemID>252556772355</ItemID><ResponseDetails><ResponseEnabled>true</ResponseEnabled><ResponseURL>http://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&item=252556772355&requested=rjweber11777&qid=1385568359014&redirect=0&messageid=m82656600067</ResponseURL><UserResponseDate>2016-10-28T22:03:49.000Z</UserResponseDate></ResponseDetails><Folder><FolderID>0</FolderID></Folder><MessageType>AskSellerQuestion</MessageType><ListingStatus>Ended</ListingStatus><Replied>true</Replied><ItemEndTime>2016-10-03T00:37:47.000Z</ItemEndTime><ItemTitle>electrolux epic 6500 SR Vacuum Cleaner Canister aerus</ItemTitle></Message><Message><Sender>gzanf92</Sender><SendingUserID>901529120</SendingUserID><RecipientUserID>frank1002us</RecipientUserID><SendToName>frank1002us</SendToName><Subject>Details about item: gzanf92 sent a message about Miele S7580 Bolero Upright HEPA Vacuum Cleaners #252606124491</Subject><MessageID>82656443607</MessageID><ExternalMessageID>1394679122010</ExternalMessageID><Flagged>false</Flagged><Read>true</Read><ReceiveDate>2016-10-28T00:28:33.000Z</ReceiveDate><ExpirationDate>2017-10-28T00:28:33.000Z</ExpirationDate><ItemID>252606124491</ItemID><ResponseDetails><ResponseEnabled>true</ResponseEnabled><ResponseURL>http://contact.ebay.com/ws/eBayISAPI.dll?M2MContact&item=252606124491&requested=gzanf92&qid=1394679122010&redirect=0&messageid=m82656443607</ResponseURL><UserResponseDate>2016-10-28T22:00:33.000Z</UserResponseDate></ResponseDetails><Folder><FolderID>0</FolderID></Folder><MessageType>AskSellerQuestion</MessageType><Replied>true</Replied><ItemEndTime>2016-11-02T18:52:48.000Z</ItemEndTime><ItemTitle> Miele S7580 Bolero Upright HEPA Vacuum Cleaners</ItemTitle></Message></Messages></GetMyMessagesResponse>

Share this post


Link to post
Share on other sites

$xml = simplexml_load_string($responseXml);

foreach ($xml->Messages->Message as $mes) {
echo $mes->MessageID . '<br>';
}

Share this post


Link to post
Share on other sites

thanks this works.  can you tell me why it didn't work the other way?

i am planning to do this with a lot of different calls, so it would be good to know

Edited by hungryfrank

Share this post


Link to post
Share on other sites

You aren't process the array at the correct level. Add the line indicated to view the array key. You should have keys0, 1, 2, ....

    $this_temp_array = $results->Messages;
    foreach ($this_temp_array as $key => $value) {
        echo "Key is: $key<br>";                        // <-- add this to get a clue
        if ($key == $n)
            $Message = $value;
        //print_r ($Message);
        $MessageID = $Message->Message->MessageID;                

        $n=$n+1;
        echo $MessageID;
    }

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.