Tuesday, 22 November 2016
php - Get all value of h1 tag
Answer
I want to get all value of h1 tag and I found this article: getting all values from h1 tags using php
Then I tried to using:
include "functions/simple_html_dom.php";
function getTextBetweenTags($string, $tagname) {
// Create DOM from string
$html = str_get_html($string);
$titles = array();
// Find all tags
foreach($html->find($tagname) as $element) {
$titles[] = $element->plaintext;
}
return $titles;
}
echo getTextBetweenTags("http://mydomain.com/","h1");
?>
But it's not running and I get:
Notice: Array to string conversion in C:\xampp\htdocs\checker\abc.php
on line 14 Array
Plz help me fix it. I want to get all h1 tag of a website with input data is URL of that website. Thanks so much!
Subscribe to:
Post Comments (Atom)
c++ - Does curly brackets matter for empty constructor?
Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...
-
A fair amount of the second act of The Dark Knight Rises has a class warfare plotline. This is foreshadowed in the trailers with Selina Ky...
-
I want to create an options array from a string. How can i create an array as { width : 100, height : 200 } from a string ...
-
I'm trying to set the size of a CardView inside of a DialogFragment , but I get this error: java.lang.NullPointerException: Attempt t...
No comments:
Post a Comment