0

この XML データを受け取り、var_dump しました。

これを使用して、内部からレコードの 1 つを取得するにはどうすればよいですか? $this->{product}->name などのように?

object(SimpleXMLElement)#189 (1) { ["products"]=> object(SimpleXMLElement)#188 (2) { ["@attributes"]=> array(3) { ["total-matched"]=> string(1) "3" ["records-returned"]=> string(1) "3" ["page-number"]=> string(1) "1" } ["product"]=> array(3) { [0]=> object(SimpleXMLElement)#206 (19) { ["ad-id"]=> string(8) "10581256" ["advertiser-id"]=> string(7) "2466656" ["advertiser-name"]=> string(18) "Everydaysource.com" ["advertiser-category"]=> string(21) "MP3 Accessories>Cases" ["buy-url"]=> string(245) "http://www.kqzyfj.com/click-4107027-10581256?url=http%3A%2F%2Fwww.everydaysource.com%2Fproduct%2Fsnap-on-case-compatible-with-apple-ipod-touch-4th-gen-colorful-zebra%2Fdapptoucco62%3Fesaffcojudtf120626%3Daf%2Bcj%2Bdapptoucco62&cjsku=DAPPTOUCCO62" ["catalog-id"]=> string(8) "cjo:2691" ["currency"]=> string(3) "USD" ["description"]=> string(57) "Compatible With Apple®:iPod touch® 4th Generation" ["image-url"]=> string(73) "http://cdn1.everydaysource.com/cdn2/110207/fb/28/d2/dapptoucco62_1_es.jpg" ["in-stock"]=> object(SimpleXMLElement)#98 (0) { } ["isbn"]=> object(SimpleXMLElement)#99 (0) { } ["manufacturer-name"]=> string(14) "EverydaySource" ["manufacturer-sku"]=> string(12) "DAPPTOUCCO62" ["name"]=> string(69) "Snap-on Case Compatible with Apple iPod Touch 4th Gen,Colorful Zebra" ["price"]=> string(4) "8.99" ["retail-price"]=> string(3) "0.0" ["sale-price"]=> string(3) "0.0" ["sku"]=> string(12) "DAPPTOUCCO62" ["upc"]=> string(12) "628569324674" } [1]=> object(SimpleXMLElement)#100 (19) { ["ad-id"]=> string(8) "10402409" ["advertiser-id"]=> string(7) "1636472" ["advertiser-name"]=> string(8) "Eforcity" ["advertiser-category"]=> string(21) "MP3 Accessories>Cases" ["buy-url"]=> string(233) "http://www.jdoqocy.com/click-4107027-10402409?url=http%3A%2F%2Fwww.eforcity.com%2Fsnap-on-case-compatible-with-apple-ipod-touch-4th-gen-colorful-zebra-dapptoucco62.html%3Fefaffcojudtf120626%3Daf%2Bcj%2Bdapptoucco62&cjsku=DAPPTOUCCO62" ["catalog-id"]=> string(8) "cjo:1136" ["currency"]=> string(3) "USD" ["description"]=> string(57) "Compatible With Apple®:iPod touch® 4th Generation" ["image-url"]=> string(68) "http://cdn1.eforcity.com/cdn2/110101/41/86/a3/dapptoucco62_1_efc.jpg" ["in-stock"]=> object(SimpleXMLElement)#99 (0) { } ["isbn"]=> object(SimpleXMLElement)#98 (0) { } ["manufacturer-name"]=> string(8) "eForCity" ["manufacturer-sku"]=> string(12) "DAPPTOUCCO62" ["name"]=> string(69) "Snap-on Case Compatible with Apple iPod Touch 4th Gen,Colorful Zebra" ["price"]=> string(4) "7.99" ["retail-price"]=> string(3) "0.0" ["sale-price"]=> string(3) "0.0" ["sku"]=> string(12) "DAPPTOUCCO62" ["upc"]=> string(12) "628569324674" } [2]=> object(SimpleXMLElement)#101 (19) { ["ad-id"]=> string(8) "10581247" ["advertiser-id"]=> string(7) "2466659" ["advertiser-name"]=> string(15) "iTrimming Corp." ["advertiser-category"]=> string(21) "MP3 Accessories>Cases" ["buy-url"]=> string(165) "http://www.dpbolvw.net/click-4107027-10581247?url=http%3A%2F%2Fwww.itrimming.com%2Fdapptoucco62.html%3Fitaffcojudtf120626%3Daf%2Bcj%2Bdapptoucco62&cjsku=DAPPTOUCCO62" ["catalog-id"]=> string(8) "cjo:2690" ["currency"]=> string(3) "USD" ["description"]=> string(57) "Compatible With Apple®:iPod touch® 4th Generation" ["image-url"]=> string(68) "http://cdn1.itrimming.com/cdn2/110301/c9/cc/33/dapptoucco62_1_it.jpg" ["in-stock"]=> object(SimpleXMLElement)#98 (0) { } ["isbn"]=> object(SimpleXMLElement)#99 (0) { } ["manufacturer-name"]=> string(9) "iTrimming" ["manufacturer-sku"]=> string(12) "DAPPTOUCCO62" ["name"]=> string(69) "Snap-on Case Compatible with Apple iPod Touch 4th Gen,Colorful Zebra" ["price"]=> string(4) "7.59" ["retail-price"]=> string(3) "0.0" ["sale-price"]=> string(3) "0.0" ["sku"]=> string(12) "DAPPTOUCCO62" ["upc"]=> string(12) "628569324674" } } } }

同じの Pastebin : http://pastebin.com/XYN8ysEG

ありがとうございました!

** 編集 **

生データはこちら

object(SimpleXMLElement)#189 (1) {
  ["products"]=>
  object(SimpleXMLElement)#188 (2) {
    ["@attributes"]=>
    array(3) {
      ["total-matched"]=>
      string(1) "4"
      ["records-returned"]=>
      string(1) "4"
      ["page-number"]=>
      string(1) "1"
    }
    ["product"]=>
    array(4) {
      [0]=>
      object(SimpleXMLElement)#206 (19) {
        ["ad-id"]=>
        string(8) "10450940"
        ["advertiser-id"]=>
        string(7) "1427863"
        ["advertiser-name"]=>
        string(12) "Bookbyte.com"
        ["advertiser-category"]=>
        string(5) "Books"
        ["buy-url"]=>
        string(151) "http://www.anrdoezrs.net/click-4107027-10450940?url=http%3A%2F%2Fwww.bookbyte.com%2Fproduct.aspx%3Fisbn%3D1576751740%26noredirect%3Dtrue&cjsku=13671976"
        ["catalog-id"]=>
        string(8) "cjo:1574"
        ["currency"]=>
        string(3) "USD"
        ["description"]=>
        string(34) "This book is in Like New condition"
        ["image-url"]=>
        object(SimpleXMLElement)#77 (0) {
        }
        ["in-stock"]=>
        object(SimpleXMLElement)#74 (0) {
        }
        ["isbn"]=>
        string(10) "1576751740"
        ["manufacturer-name"]=>
        object(SimpleXMLElement)#75 (0) {
        }
        ["manufacturer-sku"]=>
        object(SimpleXMLElement)#72 (0) {
        }
        ["name"]=>
        string(53) "Leadership and Self Deception: Getting Out of the Box"
        ["price"]=>
        string(4) "13.5"
        ["retail-price"]=>
        string(5) "14.95"
        ["sale-price"]=>
        string(3) "0.0"
        ["sku"]=>
        string(8) "13671976"
        ["upc"]=>
        object(SimpleXMLElement)#73 (0) {
        }
      }
      [1]=>
      object(SimpleXMLElement)#78 (19) {
        ["ad-id"]=>
        string(8) "10450940"
        ["advertiser-id"]=>
        string(7) "1427863"
        ["advertiser-name"]=>
        string(12) "Bookbyte.com"
        ["advertiser-category"]=>
        string(5) "Books"
        ["buy-url"]=>
        string(148) "http://www.jdoqocy.com/click-4107027-10450940?url=http%3A%2F%2Fwww.bookbyte.com%2Fproduct.aspx%3Fisbn%3D1576751740%26noredirect%3Dtrue&cjsku=1084348"
        ["catalog-id"]=>
        string(8) "cjo:1574"
        ["currency"]=>
        string(3) "USD"
        ["description"]=>
        string(41) "This book is in New - Excellent condition"
        ["image-url"]=>
        object(SimpleXMLElement)#73 (0) {
        }
        ["in-stock"]=>
        object(SimpleXMLElement)#72 (0) {
        }
        ["isbn"]=>
        string(10) "1576751740"
        ["manufacturer-name"]=>
        object(SimpleXMLElement)#75 (0) {
        }
        ["manufacturer-sku"]=>
        object(SimpleXMLElement)#74 (0) {
        }
        ["name"]=>
        string(53) "Leadership and Self Deception: Getting Out of the Box"
        ["price"]=>
        string(5) "11.21"
        ["retail-price"]=>
        string(5) "14.95"
        ["sale-price"]=>
        string(3) "0.0"
        ["sku"]=>
        string(7) "1084348"
        ["upc"]=>
        object(SimpleXMLElement)#77 (0) {
        }
      }
      [2]=>
      object(SimpleXMLElement)#79 (19) {
        ["ad-id"]=>
        string(8) "10450940"
        ["advertiser-id"]=>
        string(7) "1427863"
        ["advertiser-name"]=>
        string(12) "Bookbyte.com"
        ["advertiser-category"]=>
        string(5) "Books"
        ["buy-url"]=>
        string(148) "http://www.kqzyfj.com/click-4107027-10450940?url=http%3A%2F%2Fwww.bookbyte.com%2Fproduct.aspx%3Fisbn%3D1576751740%26noredirect%3Dtrue&cjsku=12530742"
        ["catalog-id"]=>
        string(8) "cjo:1574"
        ["currency"]=>
        string(3) "USD"
        ["description"]=>
        string(34) "This book is in Like New condition"
        ["image-url"]=>
        object(SimpleXMLElement)#77 (0) {
        }
        ["in-stock"]=>
        object(SimpleXMLElement)#74 (0) {
        }
        ["isbn"]=>
        string(10) "1576751740"
        ["manufacturer-name"]=>
        object(SimpleXMLElement)#75 (0) {
        }
        ["manufacturer-sku"]=>
        object(SimpleXMLElement)#72 (0) {
        }
        ["name"]=>
        string(53) "Leadership and Self Deception: Getting Out of the Box"
        ["price"]=>
        string(5) "29.25"
        ["retail-price"]=>
        string(5) "14.95"
        ["sale-price"]=>
        string(3) "0.0"
        ["sku"]=>
        string(8) "12530742"
        ["upc"]=>
        object(SimpleXMLElement)#73 (0) {
        }
      }
      [3]=>
      object(SimpleXMLElement)#76 (19) {
        ["ad-id"]=>
        string(8) "10586024"
        ["advertiser-id"]=>
        string(7) "2172304"
        ["advertiser-name"]=>
        string(5) "Chegg"
        ["advertiser-category"]=>
        string(45) "Media > Books > Non-Fiction > Education Books"
        ["buy-url"]=>
        string(116) "http://www.dpbolvw.net/click-4107027-10586024?url=http%3A%2F%2Fwww.chegg.com%2Fdetails%2F1576751740&cjsku=1576751740"
        ["catalog-id"]=>
        string(8) "cjo:2718"
        ["currency"]=>
        string(3) "USD"
        ["description"]=>
        string(584) "The disease of self-deception (acting in ways contrary to what one knows is right) underlies all leadership problems in today's organizations, according to the premise of this work. However well intentioned they may be, leaders who deceive themselves always end up undermining their own performance.This straightforward book explains how leaders can discover their own self-deceptions and learn how to escape destructive patterns. The authors demonstrate that breaking out of these patterns leads to improved teamwork, commitment, trust, communication, motivation, and leadership."
        ["image-url"]=>
        string(53) "http://c.chegg.com/covers2/10000/15246_1307127219.jpg"
        ["in-stock"]=>
        object(SimpleXMLElement)#73 (0) {
        }
        ["isbn"]=>
        string(10) "1576751740"
        ["manufacturer-name"]=>
        string(9) "chegg.com"
        ["manufacturer-sku"]=>
        object(SimpleXMLElement)#72 (0) {
        }
        ["name"]=>
        string(29) "Leadership and Self-Deception"
        ["price"]=>
        string(4) "9.99"
        ["retail-price"]=>
        string(5) "15.95"
        ["sale-price"]=>
        string(3) "0.0"
        ["sku"]=>
        string(10) "1576751740"
        ["upc"]=>
        string(13) "9781576751749"
      }
    }
  }
}
4

1 に答える 1

3

それらはオブジェクトです (SimpleXMLElement)

$result->products->product[0]->name
于 2012-08-22T06:39:22.497 に答える