0
$doc=new DOMDocument(); 
 $doc->loadHTML($str);  
 $doc->getElementById("MainTable")->getAttribute("id");

Displays the error

Fatal error: Call to a member function getAttribute() on a non-object

Oh and $str is the HTML of a page :p

D: Am I doing something wrong? :o

Edited by GigsD4X: n/a

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by GigsD4X
0

Didn't get your logic.
You are searching from id and want id of searched field ??

-facepalm-
I was isolating parts from the rest of the code to see which part wasn't working. And in order for it to actually do something, I just put that there.

0

LOL XD I found the problem :3 The page I was grabbing (to view its source code) was redirecting to something else :p

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.