Created
March 14, 2017 17:30
-
-
Save yawo/784d083504ff3d99afcdeebd18299cca to your computer and use it in GitHub Desktop.
This file contains 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 | |
use GuzzleHttp\Client; | |
$productUrlPatterns = ["https?://www.ysl.com/fr/shop-product/.*_cod(.*)\.html.*"]; | |
require __DIR__ . '/../vendor/autoload.php'; | |
$headers= [ | |
'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36' | |
,'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' | |
,'Accept-Encoding'=> 'gzip, deflate, sdch' | |
,'Upgrade-Insecure-Requests' => 1 | |
,'Accept-Language' => 'fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4,de;q=0.2' | |
,'Proxy-Connection' => 'keep-alive' | |
,'Host' => 'www.ysl.com' | |
]; | |
$options = ['cookies' => false, 'verify' => false, | |
'headers' =>$headers | |
]; | |
$client = new Client($options); | |
$res = $client->request('GET', 'http://www.ysl.com/fr'); | |
//Get all link | |
//Filter link on pattern | |
//Follow again | |
//Stop on level 3 | |
function followChildren($res,$level) { | |
//code to be executed; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment