frank1002us Posted May 31, 2012 Share Posted May 31, 2012 i am trying to print out some of the values that is returned using this foreach($results->Item->ShippingDetails->CalculatedShippingRate as $key => $value) { if($key == "PackageDepth") $PackageDepth = $value ; if($key == "PackageLength") $PackageLength = $value ; if($key == "PackageWidth") $PackageWidth = $value ; if($key == "WeightMajor") $WeightMajor = $value ; if($key == "WeightMinor") $WeightMinor = $value ; if($key == "OriginatingPostalCode") $OriginatingPostalCode = $value ; if($key == "ShippingIrregular") $ShippingIrregular = $value ; if($key == "ShippingPackage") $ShippingPackage = $value ; if($key == "PackagingHandlingCosts") $PackagingHandlingCosts = $value ; } i get the correct value for $OriginatingPostalCode. but for $PackageLength, $PackageWidth, $WeightMajor and some other ones i get Object id #35 and Object id #36 and so on. What i have noticed is that these values are repeated in two different array, and i get the same result no matter which one i try. also if you notice there are two <ShippingServiceOptions> and i want to access the values in both these array but i get the same Object id #51 result. bellow is the response from ebay. i would appreciate any help :'( <Item> <AutoPay>false</AutoPay> <BuyerProtection>ItemIneligible</BuyerProtection> <BuyItNowPrice currencyID="USD">42.79</BuyItNowPrice> <Country>US</Country> <Currency>USD</Currency> <Description>Regional Code: 2 (Japan, Europe, Middle East, South Africa).
 <br />
 Languages: English, Deutsch.
 <br />
 Subtitles: English, Deutsch, Spanish.
 <br />
 Audio: Dolby Surround 5.1.
 <br />
 Picture Format: 16:9 Wide-Screen.
 <br />
 Length: (approx) 122 minutes.
 <br />
 Other: Interactive Menus, Chapter Selection, Subtitles (more languages).</Description> <GiftIcon>0</GiftIcon> <HitCounter>NoHitCounter</HitCounter> <ItemID>110099292495</ItemID> <ListingDetails> <Adult>false</Adult> <BindingAuction>false</BindingAuction> <CheckoutEnabled>true</CheckoutEnabled> <ConvertedBuyItNowPrice currencyID="USD">42.79</ConvertedBuyItNowPrice> <ConvertedStartPrice currencyID="USD">20.0</ConvertedStartPrice> <ConvertedReservePrice currencyID="USD">0.0</ConvertedReservePrice> <HasReservePrice>false</HasReservePrice> <StartTime>2012-05-29T14:53:01.000Z</StartTime> <EndTime>2012-06-01T14:53:01.000Z</EndTime> <ViewItemURL>http://cgi.sandbox.ebay.com/Die-Hard-Vengeance-/110099292495</ViewItemURL> <HasUnansweredQuestions>false</HasUnansweredQuestions> <HasPublicMessages>false</HasPublicMessages> <BuyItNowAvailable>true</BuyItNowAvailable> <ExpressListing>false</ExpressListing> <ViewItemURLForNaturalSearch>http://cgi.sandbox.ebay.com/Die-Hard-Vengeance-/110099292495</ViewItemURLForNaturalSearch> </ListingDetails> <ListingDesigner> <LayoutID>10000</LayoutID> <ThemeID>10</ThemeID> </ListingDesigner> <ListingDuration>Days_3</ListingDuration> <ListingType>Chinese</ListingType> <Location>United States</Location> <PaymentMethods>PayPal</PaymentMethods> <PayPalEmailAddress>[email protected]</PayPalEmailAddress> <PrimaryCategory> <CategoryID>175677</CategoryID> <CategoryName>Computers/Tablets & Networking:Laptop & Desktop Accessories:Case Mods, Stickers & Decals</CategoryName> </PrimaryCategory> <PrivateListing>false</PrivateListing> <Quantity>1</Quantity> <ReservePrice currencyID="USD">0.0</ReservePrice> <ReviseStatus> <ItemRevised>false</ItemRevised> </ReviseStatus> <SecondaryCategory> <CategoryID>175680</CategoryID> <CategoryName>Computers/Tablets & Networking:Laptop & Desktop Accessories:Hard Drive Pouches</CategoryName> </SecondaryCategory> <Seller> <AboutMePage>false</AboutMePage> <Email>[email protected]</Email> <FeedbackScore>117</FeedbackScore> <PositiveFeedbackPercent>0.0</PositiveFeedbackPercent> <FeedbackPrivate>false</FeedbackPrivate> <FeedbackRatingStar>Turquoise</FeedbackRatingStar> <IDVerified>true</IDVerified> <eBayGoodStanding>true</eBayGoodStanding> <NewUser>false</NewUser> <RegistrationDate>1995-01-01T00:00:00.000Z</RegistrationDate> <Site>US</Site> <Status>Confirmed</Status> <UserID>testuser_osc-frank</UserID> <UserIDChanged>true</UserIDChanged> <UserIDLastChanged>2012-05-24T15:12:21.000Z</UserIDLastChanged> <VATStatus>NoVATTax</VATStatus> <SellerInfo> <AllowPaymentEdit>true</AllowPaymentEdit> <CheckoutEnabled>true</CheckoutEnabled> <CIPBankAccountStored>false</CIPBankAccountStored> <GoodStanding>true</GoodStanding> <LiveAuctionAuthorized>false</LiveAuctionAuthorized> <MerchandizingPref>OptIn</MerchandizingPref> <QualifiesForB2BVAT>false</QualifiesForB2BVAT> <StoreOwner>false</StoreOwner> <ExpressEligible>false</ExpressEligible> <ExpressWallet>false</ExpressWallet> <SafePaymentExempt>true</SafePaymentExempt> </SellerInfo> <MotorsDealer>false</MotorsDealer> </Seller> <SellingStatus> <BidCount>0</BidCount> <BidIncrement currencyID="USD">0.5</BidIncrement> <ConvertedCurrentPrice currencyID="USD">20.0</ConvertedCurrentPrice> <CurrentPrice currencyID="USD">20.0</CurrentPrice> <LeadCount>0</LeadCount> <MinimumToBid currencyID="USD">20.0</MinimumToBid> <QuantitySold>0</QuantitySold> <ReserveMet>true</ReserveMet> <SecondChanceEligible>false</SecondChanceEligible> <ListingStatus>Active</ListingStatus> </SellingStatus> <ShippingDetails> <ApplyShippingDiscount>false</ApplyShippingDiscount> <CalculatedShippingRate> <OriginatingPostalCode>10075</OriginatingPostalCode> <PackageDepth measurementSystem="English" unit="inches">10</PackageDepth> <PackageLength measurementSystem="English" unit="inches">12</PackageLength> <PackageWidth measurementSystem="English" unit="inches">5</PackageWidth> <PackagingHandlingCosts currencyID="USD">10.0</PackagingHandlingCosts> <ShippingIrregular>false</ShippingIrregular> <ShippingPackage>PackageThickEnvelope</ShippingPackage> <WeightMajor measurementSystem="English" unit="lbs">2</WeightMajor> <WeightMinor measurementSystem="English" unit="oz">0</WeightMinor> </CalculatedShippingRate> <SalesTax> <SalesTaxPercent>0.0</SalesTaxPercent> <ShippingIncludedInTax>false</ShippingIncludedInTax> </SalesTax> <ShippingServiceOptions> <ShippingService>UPSGround</ShippingService> <ShippingServicePriority>1</ShippingServicePriority> <ExpeditedService>false</ExpeditedService> <ShippingTimeMin>1</ShippingTimeMin> <ShippingTimeMax>5</ShippingTimeMax> </ShippingServiceOptions> <ShippingServiceOptions> <ShippingService>UPSNextDay</ShippingService> <ShippingServicePriority>2</ShippingServicePriority> <ExpeditedService>true</ExpeditedService> <ShippingTimeMin>1</ShippingTimeMin> <ShippingTimeMax>1</ShippingTimeMax> </ShippingServiceOptions> <ShippingType>Calculated</ShippingType> <ThirdPartyCheckout>false</ThirdPartyCheckout> <ShippingDiscountProfileID>0</ShippingDiscountProfileID> <InternationalShippingDiscountProfileID>0</InternationalShippingDiscountProfileID> <SellerExcludeShipToLocationsPreference>false</SellerExcludeShipToLocationsPreference> </ShippingDetails> <ShipToLocations>US</ShipToLocations> <ShipToLocations>Europe</ShipToLocations> <ShipToLocations>CA</ShipToLocations> <Site>US</Site> <StartPrice currencyID="USD">20.0</StartPrice> <TimeLeft>P1DT12H34M49S</TimeLeft> <Title>Die Hard With A Vengeance</Title> <HitCount>0</HitCount> <GetItFast>false</GetItFast> <SKU>12</SKU> <PostalCode>10075</PostalCode> <PictureDetails> <GalleryType>Gallery</GalleryType> <GalleryURL>http://xxx.com/osc/catalog/images/dvd/die_hard_3.gif</GalleryURL> <PhotoDisplay>None</PhotoDisplay> <PictureURL>http://xxx.com/osc/catalog/images/dvd/die_hard_3.gif</PictureURL> <ExternalPictureURL>http:/xxx.com/osc/catalog/images/dvd/die_hard_3.gif</ExternalPictureURL> </PictureDetails> <DispatchTimeMax>3</DispatchTimeMax> <ProxyItem>false</ProxyItem> <BuyerGuaranteePrice currencyID="USD">20000.0</BuyerGuaranteePrice> <IntangibleItem>false</IntangibleItem> <ReturnPolicy> <RefundOption>MoneyBack</RefundOption> <Refund>Money Back</Refund> <ReturnsWithinOption>Days_14</ReturnsWithinOption> <ReturnsWithin>14 Days</ReturnsWithin> <ReturnsAcceptedOption>ReturnsAccepted</ReturnsAcceptedOption> <ReturnsAccepted>Returns Accepted</ReturnsAccepted> <Description>Return Policy</Description> <ShippingCostPaidByOption>Buyer</ShippingCostPaidByOption> <ShippingCostPaidBy>Buyer</ShippingCostPaidBy> </ReturnPolicy> <PaymentAllowedSite>eBayMotors</PaymentAllowedSite> <PaymentAllowedSite>CanadaFrench</PaymentAllowedSite> <PaymentAllowedSite>Canada</PaymentAllowedSite> <PaymentAllowedSite>US</PaymentAllowedSite> <ConditionID>1000</ConditionID> <ConditionDisplayName>New</ConditionDisplayName> <PostCheckoutExperienceEnabled>false</PostCheckoutExperienceEnabled> <ShippingPackageDetails> <PackageDepth measurementSystem="English" unit="inches">10</PackageDepth> <PackageLength measurementSystem="English" unit="inches">12</PackageLength> <PackageWidth measurementSystem="English" unit="inches">5</PackageWidth> <ShippingIrregular>false</ShippingIrregular> <ShippingPackage>PackageThickEnvelope</ShippingPackage> <WeightMajor measurementSystem="English" unit="lbs">2</WeightMajor> <WeightMinor measurementSystem="English" unit="oz">0</WeightMinor> </ShippingPackageDetails> </Item> Link to comment https://forums.phpfreaks.com/topic/263425-parsing-the-ebay-response/ Share on other sites More sharing options...
Barand Posted May 31, 2012 Share Posted May 31, 2012 Shipping service options <?php $x = simplexml_load_string($xml_str); foreach($x->xpath('//ShippingServiceOptions') as $opts) { foreach($opts as $k=>$v) echo "$k : $v<br />"; echo "<br /><br />"; } ?> --> ShippingService : UPSGround ShippingServicePriority : 1 ExpeditedService : false ShippingTimeMin : 1 ShippingTimeMax : 5 ShippingService : UPSNextDay ShippingServicePriority : 2 ExpeditedService : true ShippingTimeMin : 1 ShippingTimeMax : 1 Link to comment https://forums.phpfreaks.com/topic/263425-parsing-the-ebay-response/#findComment-1350086 Share on other sites More sharing options...
frank1002us Posted June 2, 2012 Author Share Posted June 2, 2012 thank you very much Link to comment https://forums.phpfreaks.com/topic/263425-parsing-the-ebay-response/#findComment-1350446 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.