Last active
October 6, 2020 05:51
-
-
Save remoharsono/72d60a93846de69ce4587ceb0f63dffd to your computer and use it in GitHub Desktop.
Revisions
-
remoharsono renamed this gist
Oct 6, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
remoharsono revised this gist
Oct 6, 2020 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,6 @@ <?php // https://twitter.com/the_paTiku/status/1276075890812878848 require 'vendor/autoload.php'; use GuzzleHttp\Client; -
remoharsono created this gist
Jun 25, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ <?php require 'vendor/autoload.php'; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\Request; use DiDom\Document; use DiDom\Query; $client = new \GuzzleHttp\Client(); $base = 'https://resellers.tp-partner.pl'; $url = $base . '/?action=sklepy&cmd=getCity&pr=zachodniopomorskie'; $response = $client->request('GET', $url); $html = (string) $response->getBody(); $document = new Document($html); $links = $document->find('.miasta > li > a::attr(href)'); foreach($links as $link) { $url = $base . $link; $response = $client->request('GET', $url); $html = (string) $response->getBody(); $document = new Document($html); $emails = $document->find('.email > a::attr(href)'); if (!empty($emails)) { echo str_replace("mailto:", "", $emails[0]) . "\n"; } }