object - PHP - How to call method from a variable -
i hope may able me out. building scrape script using simple html dom.
i have few sites need thumbnail path, name of movie , other stuffs. have build me admin panel save in plaintext methods required find stuff based on matching pattern.
eg.
$movie_name = $result->children(0)->children(0)->innertext;
this works supposed work when save children(0)->children(0)->innertext in database , variable, eg,
$variable = "children(0)->children(0)->innertext"; $movie_name = $result->$variable;
it not work.
i pretty sure going horribly wrong this, please give me hint how save methods in plaintext , call them.
it must stored in plaintext because dom changing able keep it.
best regards.
you're looking php eval()
function:
$movie_name = $result->eval($variable);
having said that, warned eval evil.
instead, recommend xpath
.
hope helps!
Comments
Post a Comment