Menu

#59 Slashdot example updated

v1.0_(example)
closed
None
1
2022-04-09
2021-09-08
ignasi tort
No

I will write it down just for new user can test easily Slashdot example.
It's not exactly the same as previous example but it works.
Prints titles of first page articles in Slashdot.


$html = file_get_html( $url);
// Finds nodes within span tag and class 'story-title' tag a without class assigned
$articles = $html->find('span.story-title a[!class]'); // result is an array of onode objects
foreach ( $articles as $key => $article){
echo $key;
echo ( $article->innertext).'
'; // echo inner text
}

Discussion

  • LogMANOriginal

    LogMANOriginal - 2022-04-09
    • status: open --> closed
    • assigned_to: LogMANOriginal
     

Log in to post a comment.

MongoDB Logo MongoDB
Gen AI apps are built with MongoDB Atlas
Atlas offers built-in vector search and global availability across 125+ regions. Start building AI apps faster, all in one place.
Try Free →