Sergey Scopin
Sergey Scopin

Reputation: 2245

PHP simple html dom parser. Empty span

I'm trying to parse the site with folowing code.

<span id="ctl00_cphBody_resList_pnlResumes_rptResumes_ctl01_Label1" class="address">Somename, <nobr>Someage</nobr></span>

I'm parsing it this way

$fio=$text_specialty_next->find('span#ctl00_cphBody_resList_pnlResumes_rptResumes_ct'.$n.'_Label1');

But when I'm trying to print the result,

echo $fio->innertext;

There result is empty. What can cause this problem?

Upvotes: 1

Views: 1164

Answers (3)

Sergey Scopin
Sergey Scopin

Reputation: 2245

The problem was solved. $find->smth returns array, whick doesn't have innertext of course. I have to use foreach(find->smth as $someelement) to echo it.

Upvotes: 0

Eray
Eray

Reputation: 7128

in find()

rptResumes_ct'.$n.'_Label1'

but it should be

rptResumes_ctl'.$n.'_Label1'

You miss an "l"

And what is the value of $n ?

Upvotes: 2

Jonathan
Jonathan

Reputation: 585

Does $n="l01"? What parser are you using? In SimpleHTMLDom you need to use find(span[id=...]);

Upvotes: 1

Related Questions