1
I want to use the PHP Simple HTML DOM Parser to remove certain links from a page generated in Frontpage the problem I found is the following as Frontpage does not generate any html element with id
or class
i wonder if it is possible to indicate a way for this to be done
the page on which I want to remove the links is not mine, I’m just extracting data from it
my returned Xpath was the following /html/body/table/tbody/tr[1]/td[2]/table/tbody/tr[2]/td/table/tbody/tr/td[2]/table/tbody/tr[3]/td/table/tbody/tr[1]/td/div font/p[1]//Strong Array to string notice
– wwwjsw
It is because the method probably returns an array of nodes, even if it has only one node. You should iterate through this array.
– Rodrigo Rigotti
sorry but did not understand! has some example?
– wwwjsw
Which line of code returns "Array to string Conversion"?
– Rodrigo Rigotti
include('simple_html_dom.php');
$content = file_get_html('http://www.abresi.com.br/noticia_700.htm');
$elems = $content->find("/html/body/table/tbody/tr[1]/td[2]/table/tbody/tr[2]/td/table/tbody/tr/td[2]/table/tbody/tr[3]/td/table/tbody/tr[1]/td/div/p[1]/font/strong");
echo $elems;
on line 5– wwwjsw
@Guilhermehenrique see his documentation: http://simplehtmldom.sourceforge.net/. The method
find
returns an array, so you need to scroll through the elements or go straight to the index of the element withfind("/html/body/table/tbody/tr[1]/td[2]/table/tbody/tr[2]/td/table/tbody/tr/td[2]/table/tbody/tr[3]/td/table/tbody/tr[1]/td/div/p[1]/font/strong", 0)
. See if it works.– Rodrigo Rigotti
Let’s go continue this discussion in chat.
– wwwjsw