I am trying to retrieve data from file_get_html($url).
$html = file_get_html($url);
foreach ($html->find("h1") as $key => $value){
echo $value."<br>";
}
foreach($html->$find("p") as $key => $edu){
echo $edu;
}
I am trying to fetch more than one value from the url. But I get this error message. I get the result for $value , but I get error with the next one.
Notice: Undefined variable: find in ...\parse.php on line 18
Fatal error: Method name must be a string in ...\parse.php on line 18
This is line 18
foreach($html->$find("p") as $key => $edu){
EDIT: Database Issue
$html = file_get_html($url);
foreach ($html->find("span[class=full-name]") as $key => $name){
echo $name."<br>";
}
Database looks like:
< span class="first-name" > Tony Stark
$result = mysqli_query($con,"INSERT INTO personal (name) VALUES ('$name')");
if (!$result){
echo "Error!<br>";
}