/    Sign up×
Community /Pin to ProfileBookmark

problems with Dom XML get_content()…

I am new to DOM XML and all the functions associated with it:
([url]http://ca.php.net/manual/en/function.domnode-get-content.php[/url])
Currently, I am trying to use the following code:

[CODE]$responseXml = file_get_contents(‘http://www.webservicex.net/stockquote.asmx/GetQuote?symbol=LU’);
echo ($responseXml . ‘<br>’);
$responseDoc = domxml_open_mem($responseXml);
$root = $responseDoc->document_element();
$node_array = $root->get_elements_by_tagname(“Stock”);
$symbol = $node_array->get_elements_by_tagname(“Symbol”);
echo ($symbol[0]->get_content());
[/CODE]

I am getting the following error:
“Fatal error: Call to a member function on a non-object in “
regarding the following code: “echo ($symbol[0]->get_content());”
Am I incorrectly creating the $responseDoc?
Any help would be appreciated…
Regards
I. Jamal

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@irf2kauthorAug 28.2006 — ok, forget it, i found my error

i feel somewhat foolish....but for those interested, file_get_contents returns '&lt;' and '&gt;' rather than '<' and '>' so the DOM document was not created correctly...
×

Success!

Help @irf2k spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...