Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Метод для получения строки с лендом
- * @param string $url
- * @return mixed|string $result
- */
- public static function getUrl($url)
- {
- $page = @file_get_contents($url);
- if (empty($page)) {
- $header[0] = "Cookie: RCPC=ae9c06ab528b1cf06d6309bc1ce6f751; _ym_uid=1477632138319101296; _ym_isad=1";
- $path_to_runtime = Yii::getAlias('@runtime') . self::COOKIE_FILE;
- $curl = curl_init($url);
- curl_setopt($curl, CURLOPT_HEADER, true);
- curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($curl, CURLOPT_COOKIEJAR, $path_to_runtime);
- curl_setopt($curl, CURLOPT_COOKIEFILE, $path_to_runtime);
- curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36");
- curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, CURLOPT_HEADER, 'Content-Type: application/x-www-form-urlencoded');
- $page = curl_exec($curl);
- }
- return $page;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement