diff --git a/lib/Fred.class.php b/lib/Fred.class.php index 843a3c4..f802e6a 100644 --- a/lib/Fred.class.php +++ b/lib/Fred.class.php @@ -78,6 +78,7 @@ class Fred { return json_decode($json); } + public function donneMoiSaPutaindeG1Pub ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday) { @@ -90,11 +91,20 @@ class Fred { // echo '
'; var_dump(htmlspecialchars($url)); echo '
'; - $page1 = file_get_contents($url) - or die('

On a fait du sale.

'); + $opts = array( + 'http'=>array( + 'method'=>"GET", + 'header'=>"Accept-language: fr\r\n", + 'follow_location' => 0 + ) + ); + + $context = stream_context_create($opts); + $page1 = file_get_contents($url, false, $context) + or die('

On a fait du sale.

'); // die('
' . htmlspecialchars($page1) . '
'); - + preg_match("`url='([^']+)'`isU", $page1, $matches); // die( @@ -108,11 +118,23 @@ class Fred { $page2 = ''; + $opts2 = array( + 'http'=>array( + 'method'=>"GET", + 'header'=>"Accept-language: fr\r\n", + 'follow_location' => 0 + ) + ); + + $context2 = stream_context_create($opts2); + + sleep(3); + while (empty($page2)) { sleep($this->gatewayDelay); - $page2 = @file_get_contents($url); + $page2 = file_get_contents($url, false, $context2) or die('
'. var_dump($page2, true) . '
'); } preg_match("`url='.*/user/([^']+)/'`isU", $page2, $matches);