These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

[SOLVED] XML fitting parser in PHP

Author
Nathan WAKE
Deep Core Mining Inc.
Caldari State
#1 - 2011-12-29 13:09:37 UTC  |  Edited by: Nathan WAKE
Hello everybody.

My apologies, I am unable to post code with HTML in it, so I'm posting link.

I am trying to "read" in php an .xml file containing a simple fitting.

Here is the fitting : Fitting

To do so, I am using cUrl, here is my code so far : Code

When I access the code page, I do have my title, and a list with 25 "black dots", but no text at all.

Obviously, I'm missing something, but I haven't a clue on what's wrong.

Thanks in advance for your help.

And happy new year.


Nathan

PS : when I uncomment line 10, my DOM tree shows up nicely

"I'm a very good housekeeper. Each time I get a divorce, I keep the house"

Zaza Gabor

Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#2 - 2011-12-29 13:53:02 UTC  |  Edited by: Steve Ronuken
try $hardware['type'] rather than $hardware->type

It's because they're attributes, rather than elements.

if you'd used
< hardware slot="rig slot 0">< type>Medium Warhead Flare Catalyst II< /type>< /hardware>
rather than the format you had used, it would have worked.

Spaces added to stop it being picked up as html

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

TorTorden
Tors shibari party
#3 - 2011-12-29 14:32:03 UTC
Slightly off topic since Steve fixed the main problem for you.
As I see it, Curl is mostly used for connecting and grabbing data on a server outside your control (I.E ccp's api server)

If your xml files are loaded up to your local server you just need to use $xml = simplexml_load_file('test.xml'); directly.


Nathan WAKE
Deep Core Mining Inc.
Caldari State
#4 - 2011-12-29 17:16:53 UTC
Holly crap !! Always that same newbie error again and again....

Thank you guys, Steve for pointing out the error, and TorTorden for simplification.

If I wasn't engaged, I'd marry you Big smile

"I'm a very good housekeeper. Each time I get a divorce, I keep the house"

Zaza Gabor

Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#5 - 2011-12-29 17:19:12 UTC
simplexml is a bit of a pita to work with. I end up using var_dump all the time to work out what structure I'm working with.

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter