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...
-
Iv'e read a lot of posts both in stackoverflow and other websites talking about web security. Such as salting encrypting etc. ...
-
I would like these values to go into my database but it just won't do it. Form Code Navn: Tilføj til dine præferencer...
-
The standard PHP way to test whether a string $str ends with a substring $test is: $endsWith = substr( $str, -strlen( $test ) ) == $test I...
No comments:
Post a Comment