Created
April 18, 2018 23:25
-
-
Save edutrul/adc57089df6548602876cf6cfe28a005 to your computer and use it in GitHub Desktop.
webscrapping example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// mkdir webscrapping folder | |
// cd webscrapping | |
// Then run composer require fabpot/goutte | |
// then create index.php with below content | |
require __DIR__ . '/vendor/autoload.php'; | |
use Goutte\Client; | |
$client = new Client(); | |
$uri = 'http://www.goal.com/es/partido/deportivo-la-coru%C3%B1a-v-sevilla/comentario-resultados/b07sxrrw4roi1qsjvhdumagyy'; | |
$crawler = $client->request('GET', $uri); | |
$comment = $crawler->filter("[class='widget-match-commentary clearfix']"); | |
$commentTitle = $comment->filter("[class='card-title']"); | |
//print $commentTitle->text(); | |
$commentDescription = $comment->filter("[class='comment-desc']")->text(); | |
//print_r($commentDescription); | |
$client = new Client(); | |
$uri = 'https://hdfull.tv/'; | |
$crawler = $client->request('GET', $uri); | |
$contentVideos = $crawler->filter("[class='breakaway-wrapper-dark']"); | |
$videos = []; | |
$contentVideosHtml = $contentVideos->filter("[class='flickr item left home-thumb-item']")->each(function ($nodeVideo) { | |
print $nodeVideo->html(); | |
}); | |
//print $contentVideosHtml->html(); | |
//print_r($contentVideosHtml); | |
print $contentVideos->filter("[class='section-title']")->children()->first()->html(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment