0

I call commission junction API and receive this as a response.

$xml_response = simplexml_load_file($xml_response);
exit($xml_response);

If I do

  $xml = new SimpleXMLElement($xml_response);

I get an application error. (Not sure how to find what error this is, where could I set error codes to show for this part?)

Warning: simplexml_load_file(): I/O warning : failed to load external entity " 106032782478435B & H Photo VideoComputers & Solutions > Laptops > MacBookshttp://www.jdoqocy.com/click-4107027-10603278?url=http://www.bhphotovideo.com/c/product/871865-REG/Apple_MD101LL_A_13_3_MacBook_Pro_Notebook.html/kw/APMBPMD101LL&cjsku=APMBPMD101LLcjo:6USDApple 13.3" MacBook Pro Notebook Computer, Intel Core i5 Dual-Core 2.5 GHz CPU, Internal 4GB DDR3 RAM, Features 500GB 5400 RPM Hard Drive, Intel HD 4000 Graphics, LED-Backlit 13.3" (33.8 cm) Display, Native 1280 x 800 Resolution, Wireless 802.11n WiFi & Bluetooth 4.0, Dual USB 3.0 Ports & Thunderbolt Port, Ships with Mac OS X Lion, Free OS X in /var/www/html/site.net/beta/library/API/CommissionJunction.php on line 119

** UPDATE **

Complete XML reponse:

string(9582) "<?xml version="1.0" encoding="UTF-8"?>
<cj-api><products total-matched="5" records-returned="5" page-number="1"><product><ad-id>10603278</ad-id><advertiser-id>2478435</advertiser-id><advertiser-name>B &amp; H Photo Video</advertiser-name><advertiser-category>Computers &amp; Solutions &gt; Laptops &gt; MacBooks</advertiser-category><buy-url>http://www.kqzyfj.com/click-4107027-10603278?url=http://www.bhphotovideo.com/c/product/871865-REG/Apple_MD101LL_A_13_3_MacBook_Pro_Notebook.html/kw/APMBPMD101LL&amp;cjsku=APMBPMD101LL</buy-url><catalog-id>cjo:6</catalog-id><currency>USD</currency><description>Apple 13.3" MacBook Pro Notebook Computer, Intel Core i5 Dual-Core 2.5 GHz CPU, Internal 4GB DDR3 RAM, Features 500GB 5400 RPM Hard Drive, Intel HD 4000 Graphics, LED-Backlit 13.3" (33.8 cm) Display, Native 1280 x 800 Resolution, Wireless 802.11n WiFi &amp; Bluetooth 4.0, Dual USB 3.0 Ports &amp; Thunderbolt Port, Ships with Mac OS X Lion, Free OS X Mountain Lion Upgrade MacBook Pro MacBook 13.3" MacBook Pro Notebook Computer</description><image-url>http://www.bhphotovideo.com/images/items/871865.jpg</image-url><in-stock></in-stock><isbn></isbn><manufacturer-name>Apple</manufacturer-name><manufacturer-sku>MD101LL/A</manufacturer-sku><name>Apple 13.3" MacBook Pro Notebook Computer</name><price>1139.0</price><retail-price>0.0</retail-price><sale-price>0.0</sale-price><sku>APMBPMD101LL</sku><upc>885909582969</upc></product><product><ad-id>10273684</ad-id><advertiser-id>242732</advertiser-id><advertiser-name>MacMall Affiliate Advantage Network</advertiser-name><advertiser-category>Systems &gt; MacBook Pro &gt; MacBook Pro w/ Intel Core i5 Processor &gt; 2.53 GHz MacBook Pro Computers</advertiser-category><buy-url>http://www.jdoqocy.com/click-4107027-10273684?url=http://www.macmall.com/p/7628870?dpno=9232227&source=zwb12166&amp;cjsku=9232227</buy-url><catalog-id>cjo:535</catalog-id><currency>USD</currency><description>2.5GHz dual-core Intel Core i5  Turbo Boost up to 3.1GHz  4GB 1600MHz memory  13.3" LED-backlit glossy widescreen display  Bluetooth 4.0  720p FaceTime camera  USB 3.0  Thunde</description><image-url>http://image1.cc-inc.com/prod/9232000/9232227_xlg.jpg</image-url><in-stock></in-stock><isbn></isbn><manufacturer-name>Apple</manufacturer-name><manufacturer-sku>MD101LL/A</manufacturer-sku><name>13.3 MacBook Pro dual-core Intel Core i5 2.5GHz  4GB RAM  500GB 5400-rpm hard drive  Intel HD Graphics 4000  Mac OS X Lion</name><price>1138.94</price><retail-price>1199.0</retail-price><sale-price>0.0</sale-price><sku>9232227</sku><upc>885909582969</upc></product><product><ad-id>10541923</ad-id><advertiser-id>2326608</advertiser-id><advertiser-name>Music123</advertiser-name><advertiser-category>Pro Audio/Computers &amp; Peripherals/Mac Computers/Notebook Mac Computers</advertiser-category><buy-url>http://www.dpbolvw.net/click-4107027-10541923?url=http://www.music123.com/pro-audio/apple-macbook-pro-13-2.5ghz-dual-core-i5-md101ll-a/h86479000000000&amp;cjsku=H86479</buy-url><catalog-id>cjo:2321</catalog-id><currency>USD</currency><description>One would think that it would be hard to improve on a great line of products, but year after year the team at Apple find a way, and they have added some powerful features to the next-generation of their MacBook Pro line of laptops. This 13 MacBook Pro (MD101LL/A) has everything youve ever looked for in an Apple computer, plus a whole lot more. Extremely fast processor upgrades, integrated HD graphics, super fast hard drive storage, USB 3.0 connections, and more. This generation of the MacBook Pro is ready for high-level performance. Top-of-the-line processors.The 13-inch model also speeds things up with either the 2.5GHz Intel Core i5 or the 2.9GHz Intel Core i7  the fastest mobile dual-core processor available. With Turbo Boost speeds up to 3.6GHz, these processors bring more power to everything you do. Learn more about processor performanceThe very latest graphics.The new integrated Intel HD Graphics 4000 processor boosts performance by up to 60 percent. That extra power gives you a smoother, more fluid experience than before. Its still highly efficient, too, so you get long battery life when youre out and about.The fastest, most versatile I/O in a notebook.Imagine accessing multiple streams of uncompressed HD video  from your MacBook Pro  at speeds that let you edit an HD feature film in real time. Thunderbolt technology allows you to connect the high-performance peripherals that make it possible. Ultrafast and ultra flexible, the Thunderbolt pipeline is up to 12 times faster than FireWire 800 and offers unprecedented expansion capabilities.FaceTime HD camera. Say hi in high def.Get more of your friends in on the fun with crisp, widescreen HD video. The picture is so clear, it will look and feel almost like youre in the same room. You can make 720p HD calls from your MacBook Pro to any Mac with a FaceTime HD camera. You can also make video calls to iPad, iPhone 4, iPhone 4S, iPod touch, and other Intel-based Mac computers.Multi-Touch trackpad. Be more hands-on.The Multi-Touch trackpad is the most natural way to interact with whats on your screen, and the smooth glass surface gives you plenty of room for gestures. Pinch to zoom in and out, swipe to flip through photos, rotate to adjust an image, and much more. The buttonless design lets you click anywhere. And if youre coming from a right-click world, you can right-click with two fingers or configure a right-click area on the trackpad. The more you use the Multi-Touch trackpad, the more youll wonder how you ever did without it.A long-lasting battery. Charge less. Do more.MacBook Pro delivers amazing battery life. And thats with more powerful processors and faster graphics than ever. An energy-efficient processor architecture with an integrated video encoder, along with automatic graphics switching in the 15-inch model, helps improve battery life. So you can get up to 7 hours on a single charge.Its very well connected.MacBook Pro automatically finds available networks and allows you to join them</description><image-url>http://static.music123.com/img/brand/m123/cmn/imagecomingsoon.gif</image-url><in-stock></in-stock><isbn></isbn><manufacturer-name>Apple</manufacturer-name><manufacturer-sku>MD101LL/A</manufacturer-sku><name>Apple MacBook Pro 13" 2.5GHz Dual-Core i5 (MD101LL/A)</name><price>1199.0</price><retail-price>1199.0</retail-price><sale-price>0.0</sale-price><sku>H86479</sku><upc>885909582969</upc></product><product><ad-id>10474050</ad-id><advertiser-id>2045991</advertiser-id><advertiser-name>Best Buy</advertiser-name><advertiser-category>Computing-LaptopsandNetbooks</advertiser-category><buy-url>http://www.kqzyfj.com/click-4107027-10474050?url=http://www.bestbuy.com/site/Apple%AE+-+MacBook%AE+Pro+-+13.3%22+Display+-+4GB+Memory+-+500GB+Hard+Drive/5430505.p?id=1218646127726&skuId=5430505&cmp=RMX&ky=2oh0NrwOl4j1qjMx3Oy2gXfVGhMUl0WiJ&ci_src=11138&ci_sku=5430505&amp;cjsku=5430505</buy-url><catalog-id>cjo:1791</catalog-id><currency>USD</currency><description>MacBook Pro features Intel's new third-generation Core architecture for a boost in processor and memory speeds. New next-generation graphicsdeliver performance levels that are up to 60 percent faster than before. And high-speed Thunderbolt I/O lets you transfer data at rates up to10 GBps. The MacBook Pro is a great computer that just got even greater.</description><image-url>http://images.bestbuy.com/BestBuy_US/images/products/5430/5430505_sc.jpg</image-url><in-stock></in-stock><isbn></isbn><manufacturer-name>Apple</manufacturer-name><manufacturer-sku>MD101LL/A</manufacturer-sku><name>Apple - MacBook Pro - 133" Display - 4GB Memory - 500GB Hard Drive</name><price>1199.99</price><retail-price>0.0</retail-price><sale-price>1199.99</sale-price><sku>5430505</sku><upc>885909582969</upc></product><product><ad-id>10479833</ad-id><advertiser-id>2014561</advertiser-id><advertiser-name>Apple Store US &amp; Apple Store Canada</advertiser-name><advertiser-category>Family : Macbook_Pro</advertiser-category><buy-url>http://www.kqzyfj.com/click-4107027-10479833?url=http://store.apple.com/us/xc/product/MD101LL/A?cid=AOS-US-AFF-FEED&aosid=p201&amp;cjsku=MD101</buy-url><catalog-id>cjo:1861</catalog-id><currency>USD</currency><description>The fastest Intel processors.       Now topping top speed.       MacBook Pro features Intel's new third-generation Core architecture, which boosts the speed of the processor and memory. And that means you have one powerful notebook on your hands. 50 percent faster graphics.       You'll be impressed. Instantly.       The 15-inch MacBook Pro features new discrete NVIDIA graphics that are up to 50 percent faster than before. New integrated Intel graphics also perform up to 50 percent faster. Thunderbolt and USB 3       I/O that sets new standards.       Thunderbolt technology lets you connect multiple high-performance devices to a single port - with data transfer rates up to 10 Gbps. Two new USB 3 ports are up to 10x faster than USB 2.</description><image-url>http://store.storeimages.cdn-apple.com/2782/as-images.apple.com/is/image/AppleInc/MC700</image-url><in-stock></in-stock><isbn></isbn><manufacturer-name>apple</manufacturer-name><manufacturer-sku>MD101LL/A</manufacturer-sku><name>Apple MacBook Pro 13&amp;quot; 2.5GHz (MD101LL/A) - Dual Core Intel Core i5, 2.5GHz, 4GB memory, 500GB hard drive, 13-inch</name><price>1199.0</price><retail-price>0.0</retail-price><sale-price>0.0</sale-price><sku>MD101</sku><upc>885909582969</upc></product></products></cj-api>"
4
  • Sorry for late reply, internet went out. Using my phone to answer. I'm receiving no errors. I simply cant parse the file the same why i do the 2nd one in the post. But looking at my post again. The one i'm able to parse is in object format. Is there a different convention for my first xml one? Commented Aug 21, 2012 at 10:12
  • @Gavin Updated question with error I'm getting now and updated code. Commented Aug 21, 2012 at 10:23
  • 1
    Could you please post the XML you are trying to parse again? It may be malformed? Commented Aug 21, 2012 at 10:32
  • @Gavin Updated the question with the complete response. Commented Aug 21, 2012 at 11:01

2 Answers 2

1

Your XML is malformed.

When trying to parse your XML, the buy-url element contains invalid content.

XML Parsing Error: not well-formed
Location: file://///cc-fs1/users$/gavin.roberts/Desktop/Noname1.xml
Line Number 2, Column 1793:<cj-api><products total-matched="5" records-returned="5" page-number="1"><product><ad-id>10603278</ad-id><advertiser-id>2478435</advertiser-id><advertiser-name>B &amp; H Photo Video</advertiser-name><advertiser-category>Computers &amp; Solutions &gt; Laptops &gt; MacBooks</advertiser-category><buy-url>http://www.kqzyfj.com/click-4107027-10603278?url=http://www.bhphotovideo.com/c/product/871865-REG/Apple_MD101LL_A_13_3_MacBook_Pro_Notebook.html/kw/APMBPMD101LL&amp;cjsku=APMBPMD101LL</buy-url><catalog-id>cjo:6</catalog-id><currency>USD</currency><description>Apple 13.3" MacBook Pro Notebook Computer, Intel Core i5 Dual-Core 2.5 GHz CPU, Internal 4GB DDR3 RAM, Features 500GB 5400 RPM Hard Drive, Intel HD 4000 Graphics, LED-Backlit 13.3" (33.8 cm) Display, Native 1280 x 800 Resolution, Wireless 802.11n WiFi &amp; Bluetooth 4.0, Dual USB 3.0 Ports &amp; Thunderbolt Port, Ships with Mac OS X Lion, Free OS X Mountain Lion Upgrade MacBook Pro MacBook 13.3" MacBook Pro Notebook Computer</description><image-url>http://www.bhphotovideo.com/images/items/871865.jpg</image-url><in-stock></in-stock><isbn></isbn><manufacturer-name>Apple</manufacturer-name><manufacturer-sku>MD101LL/A</manufacturer-sku><name>Apple 13.3" MacBook Pro Notebook Computer</name><price>1139.0</price><retail-price>0.0</retail-price><sale-price>0.0</sale-price><sku>APMBPMD101LL</sku><upc>885909582969</upc></product><product><ad-id>10273684</ad-id><advertiser-id>242732</advertiser-id><advertiser-name>MacMall Affiliate Advantage Network</advertiser-name><advertiser-category>Systems &gt; MacBook Pro &gt; MacBook Pro w/ Intel Core i5 Processor &gt; 2.53 GHz MacBook Pro Computers</advertiser-category><buy-url>http://www.jdoqocy.com/click-4107027-10273684?url=http://www.macmall.com/p/7628870?dpno=9232227&source=zwb12166&amp;cjsku=9232227</buy-url><catalog-id>cjo:535</catalog-id><currency>USD</currency><description>2.5GHz dual-core Intel Core i5  Turbo Boost up to 3.1GHz  4GB 1600MHz memory  13.3" LED-backlit glossy widescreen display  Bluetooth 4.0  720p FaceTime camera  USB 3.0  Thunde</description><image-url>http://image1.cc-inc.com/prod/9232000/9232227_xlg.jpg</image-url><in-stock></in-stock><isbn></isbn><manufacturer-name>Apple</manufacturer-name><manufacturer-sku>MD101LL/A</manufacturer-sku><name>13.3 MacBook Pro dual-core Intel Core i5 2.5GHz  4GB RAM  500GB 5400-rpm hard drive  Intel HD Graphics 4000  Mac OS X Lion</name><price>1138.94</price><retail-price>1199.0</retail-price><sale-price>0.0</sale-price><sku>9232227</sku><upc>885909582969</upc></product><product><ad-id>10541923</ad-id><advertiser-id>2326608</advertiser-id><advertiser-name>Music123</advertiser-name><advertiser-category>Pro Audio/Computers &amp; Peripherals/Mac Computers/Notebook Mac Computers</advertiser-category><buy-url>http://www.dpbolvw.net/click-4107027-10541923?url=http://www.music123.com/pro-audio/apple-macbook-pro-13-2.5ghz-dual-core-i5-md101ll-a/h86479000000000&amp;cjsku=H86479</buy-url><catalog-id>cjo:2321</catalog-id><currency>USD</currency><description>One would think that it would be hard to improve on a great line of products, but year after year the team at Apple find a way, and they have added some powerful features to the next-generation of their MacBook Pro line of laptops. This 13 MacBook Pro (MD101LL/A) has everything youve ever looked for in an Apple computer, plus a whole lot more. Extremely fast processor upgrades, integrated HD graphics, super fast hard drive storage, USB 3.0 connections, and more. This generation of the MacBook Pro is ready for high-level performance. Top-of-the-line processors.The 13-inch model also speeds things up with either the 2.5GHz Intel Core i5 or the 2.9GHz Intel Core i7  the fastest mobile dual-core processor available. With Turbo Boost speeds up to 3.6GHz, these processors bring more power to everything you do. Learn more about processor performanceThe very latest graphics.The new integrated Intel HD Graphics 4000 processor boosts performance by up to 60 percent. That extra power gives you a smoother, more fluid experience than before. Its still highly efficient, too, so you get long battery life when youre out and about.The fastest, most versatile I/O in a notebook.Imagine accessing multiple streams of uncompressed HD video  from your MacBook Pro  at speeds that let you edit an HD feature film in real time. Thunderbolt technology allows you to connect the high-performance peripherals that make it possible. Ultrafast and ultra flexible, the Thunderbolt pipeline is up to 12 times faster than FireWire 800 and offers unprecedented expansion capabilities.FaceTime HD camera. Say hi in high def.Get more of your friends in on the fun with crisp, widescreen HD video. The picture is so clear, it will look and feel almost like youre in the same room. You can make 720p HD calls from your MacBook Pro to any Mac with a FaceTime HD camera. You can also make video calls to iPad, iPhone 4, iPhone 4S, iPod touch, and other Intel-based Mac computers.Multi-Touch trackpad. Be more hands-on.The Multi-Touch trackpad is the most natural way to interact with whats on your screen, and the smooth glass surface gives you plenty of room for gestures. Pinch to zoom in and out, swipe to flip through photos, rotate to adjust an image, and much more. The buttonless design lets you click anywhere. And if youre coming from a right-click world, you can right-click with two fingers or configure a right-click area on the trackpad. The more you use the Multi-Touch trackpad, the more youll wonder how you ever did without it.A long-lasting battery. Charge less. Do more.MacBook Pro delivers amazing battery life. And thats with more powerful processors and faster graphics than ever. An energy-efficient processor architecture with an integrated video encoder, along with automatic graphics switching in the 15-inch model, helps improve battery life. So you can get up to 7 hours on a single charge.Its very well connected.MacBook Pro automatically finds available networks and allows you to join them</description><image-url>http://static.music123.com/img/brand/m123/cmn/imagecomingsoon.gif</image-url><in-stock></in-stock><isbn></isbn><manufacturer-name>Apple</manufacturer-name><manufacturer-sku>MD101LL/A</manufacturer-sku><name>Apple MacBook Pro 13" 2.5GHz Dual-Core i5 (MD101LL/A)</name><price>1199.0</price><retail-price>1199.0</retail-price><sale-price>0.0</sale-price><sku>H86479</sku><upc>885909582969</upc></product><product><ad-id>10474050</ad-id><advertiser-id>2045991</advertiser-id><advertiser-name>Best Buy</advertiser-name><advertiser-category>Computing-LaptopsandNetbooks</advertiser-category><buy-url>http://www.kqzyfj.com/click-4107027-10474050?url=http://www.bestbuy.com/site/Apple%AE+-+MacBook%AE+Pro+-+13.3%22+Display+-+4GB+Memory+-+500GB+Hard+Drive/5430505.p?id=1218646127726&skuId=5430505&cmp=RMX&ky=2oh0NrwOl4j1qjMx3Oy2gXfVGhMUl0WiJ&ci_src=11138&ci_sku=5430505&amp;cjsku=5430505</buy-url><catalog-id>cjo:1791</catalog-id><currency>USD</currency><description>MacBook Pro features Intel's new third-generation Core architecture for a boost in processor and memory speeds. New next-generation graphicsdeliver performance levels that are up to 60 percent faster than before. And high-speed Thunderbolt I/O lets you transfer data at rates up to10 GBps. The MacBook Pro is a great computer that just got even greater.</description><image-url>http://images.bestbuy.com/BestBuy_US/images/products/5430/5430505_sc.jpg</image-url><in-stock></in-stock><isbn></isbn><manufacturer-name>Apple</manufacturer-name><manufacturer-sku>MD101LL/A</manufacturer-sku><name>Apple - MacBook Pro - 133" Display - 4GB Memory - 500GB Hard Drive</name><price>1199.99</price><retail-price>0.0</retail-price><sale-price>1199.99</sale-price><sku>5430505</sku><upc>885909582969</upc></product><product><ad-id>10479833</ad-id><advertiser-id>2014561</advertiser-id><advertiser-name>Apple Store US &amp; Apple Store Canada</advertiser-name><advertiser-category>Family : Macbook_Pro</advertiser-category><buy-url>http://www.kqzyfj.com/click-4107027-10479833?url=http://store.apple.com/us/xc/product/MD101LL/A?cid=AOS-US-AFF-FEED&aosid=p201&amp;cjsku=MD101</buy-url><catalog-id>cjo:1861</catalog-id><currency>USD</currency><description>The fastest Intel processors.       Now topping top speed.       MacBook Pro features Intel's new third-generation Core architecture, which boosts the speed of the processor and memory. And that means you have one powerful notebook on your hands. 50 percent faster graphics.       You'll be impressed. Instantly.       The 15-inch MacBook Pro features new discrete NVIDIA graphics that are up to 50 percent faster than before. New integrated Intel graphics also perform up to 50 percent faster. Thunderbolt and USB 3       I/O that sets new standards.       Thunderbolt technology lets you connect multiple high-performance devices to a single port - with data transfer rates up to 10 Gbps. Two new USB 3 ports are up to 10x faster than USB 2.</description><image-url>http://store.storeimages.cdn-apple.com/2782/as-images.apple.com/is/image/AppleInc/MC700</image-url><in-stock></in-stock><isbn></isbn><manufacturer-name>apple</manufacturer-name><manufacturer-sku>MD101LL/A</manufacturer-sku><name>Apple MacBook Pro 13&amp;quot; 2.5GHz (MD101LL/A) - Dual Core Intel Core i5, 2.5GHz, 4GB memory, 500GB hard drive, 13-inch</name><price>1199.0</price><retail-price>0.0</retail-price><sale-price>0.0</sale-price><sku>MD101</sku><upc>885909582969</upc></product></products></cj-api>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^

This may be a result of the XML being malformed after you posted it on here, if so, I advise you post the raw content on pastebin, or similar with NO text formating so we can try again.

Hope that helps.

Gavin

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you very much for confirming that. Just to make sure it wasn't a format issue, here is the pastebin. pastebin.com/U8FgKQBL . Please let me know if it's still malformed when you have the time.
Unfortunately that's the same issue. It seems related to the URL's within the buy-url nodes. Could be worth double checking with CJ to see if there is a problem?
1

Im assuming you are using SimpleXML.

This part will never work: $item->cj-api->, - is an operator. If you are using SimpleXML try {'cj-api'}.

Even more core issue is that $item->cj-api will not work because there is no cj-api element present. That is the root node that does not need to be addressed. See examples at http://www.php.net/manual/en/simplexml.examples-basic.php

1 Comment

Thanks, your comment about simplexml seems to move me in the positive direction, now getting error message. Updated the question with what I did and the results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.