Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Http\Controllers;
- use App\Game;
- use App\Models\Item;
- use App\Models\ItemsBySteam;
- use App\Services\SteamItem;
- use App\Models\User;
- use Illuminate\Http\Request;
- use Carbon\Carbon;
- use Auth;
- use Illuminate\Support\Facades\Redirect;
- use App\Http\Requests;
- use App\Http\Controllers\Controller;
- use App\Http\Controllers\GameController;
- use App\Http\Controllers\RoomController;
- use App\Http\Controllers\SteamController;
- class PagesController extends Controller
- {
- const API_KEY = '9C0208A104D75E96B72DC19AA4FFD06F';
- const GROUP_ID = '27688221';
- private $steam;
- public function __construct(SteamController $steam)
- {
- parent::__construct();
- $__init_room = new RoomController();
- $this->steam = $steam;
- }
- public function addshopik()
- {
- return view('pages.addshopik');
- }
- public function shop()
- {
- $shop = \DB::table('shop')->where('status', 0)->select('id', 'name', 'inspect', 'price', 'steam_price', 'quality', 'rarity', 'classid')->orderBy('price', 'desc')->get();
- return view('pages.shop', compact('shop'));
- }
- public function support()
- {
- return view('pages.support');
- }
- public function about()
- {
- return view('pages.about');
- }
- public function streams()
- {
- return view('pages.streams');
- }
- public function donat()
- {
- return view('pages.donat');
- }
- public function escrow()
- {
- return view('pages.escrow');
- }
- function getActualCurs() {
- $str = @file_get_contents("http://www.cbr.ru/scripts/XML_daily.asp");
- if ($str != '') {
- preg_match('#<Valute ID="R01235">.*?.<Value>(.*?)</Value>.*?</Valute>#is', $str, $value);
- $usd = $value[1];
- }
- else {
- $usd = 56;
- }
- return $usd;
- }
- public function bonus()
- {
- $inventory = $this->redis->get('bonusItemsCount');
- $queue_pos = $this->getQueuePos();
- $time_reset = Carbon::today('Europe/Moscow')->subHours(7);
- $itemsCanGetToday = GameController::BONUSES_PER_DAY - \DB::table('bonus_items')->where('user_id', $this->user->steamid64)->whereNull('error')->where('date', '>', $time_reset)->count();
- /*
- if($itemsCanGetToday < 0 && $this->user->bonusesCanGet == 0) {
- $itemsCanGetToday = 0;
- }
- if($itemsCanGetToday > 0) {
- $itemsCanGetToday = ($this->user->bonusesCanGet > 100) ? $itemsCanGetToday = 100: $itemsCanGetToday = $this->user->bonusesCanGet;
- }*/
- $lastUsers = \DB::table('bonus_items')->orderBy('id', 'desc')->whereNull('error')->take(20)->get();
- return view('pages.bonus', compact('inventory', 'itemsCanGetToday', 'lastErrors', 'lastUsers', 'queue_pos'));
- }
- public function getQueuePos()
- {
- $redisQueueLen = $this->redis->llen('bonusItems');
- $res = 0;
- for ($i = 0; $i < $redisQueueLen; $i++) {
- if (stripos($this->redis->lindex('bonusItems', $i), $this->user->steamid64) !== False) {
- $res = $i+1;
- }
- }
- return $res;
- }
- public function getQueueState()
- {
- $redisQueueLen = $this->getQueuePos();
- if ($redisQueueLen > 0) {
- return response()->json(['success' => 'wait', 'text' => $redisQueueLen]);
- }
- $last_sending_state = \DB::table('bonus_items')->where('user_id', $this->user->steamid64)->orderBy('id', 'desc')->value('error');
- if ($last_sending_state == null) {
- return response()->json(['success' => 'success ', 'text' => 'Заберите в течение 2 минут']);
- }
- else {
- return response()->json(['success' => 'error', 'text' => $last_sending_state]);
- }
- }
- // public function getBonus()
- // {
- // $inventory = $this->redis->get('bonusItemsCount');
- // $this->steam->updateNickname();
- //
- // $time_reset = Carbon::today('Europe/Moscow')->subHours(7);
- // $itemsCanGetToday = GameController::BONUSES_PER_DAY - \DB::table('bonus_items')->where('user_id', $this->user->steamid64)->whereNull('error')->where('date', '>', $time_reset)->count();
- //
- // //обязательно новым запросом
- // $canGetToday = \DB::table('users')->where('steamid64', $this->user->steamid64)->sharedLock()->value('bonusesCanGet');
- //
- // if($this->user->banchat > 0) {
- // return response()->json(['success' => 'error', 'text' => 'Вы забанены в чате, и не можете учавствовать в розыгрыше!']);
- // }
- //
- // $username = $this->steam->getNickname();
- //
- // $change_btn = 'Ваш ник на данный момент: ' . $username . '<a href="https://steamcommunity.com/profiles/' . $this->user->steamid64 . '/edit" target="_blank"> <span style="background:#fa0;color:#fff;padding:4px;">Изменить ник</span></a>';
- //
- // $pattern = '#(www\.|https?://)?[A-Za-z0-9а-яА-Я]+\.[a-z0-9]{2,4}#i';
- // preg_match_all($pattern, $username, $matches, PREG_PATTERN_ORDER);
- //
- // if (count($matches[0]) > 1) {
- // return response()->json(['success' => 'error', 'text' => 'Запрещено иметь больше одного сайта в нике. ' . $change_btn]);
- // }
- //
- // if(stripos($this->user->username, "CSGOSHARK.RU") === false) {
- // return response()->json(['success' => 'error', 'text' => 'Вы не добавили имя сайта <font color="yellow">CSGOSHARK.RU</font> в свой ник. ' . $change_btn]);
- // }
- //
- // if($inventory <= 2) {
- // return response()->json(['success' => 'error', 'text' => 'На инвентаре бота закончилася дроп. Подождите немного. ']);
- // }
- //
- //// if(GameController::havegame($this->user) == false) == false) {
- //// return response()->json(['success' => 'error', 'text' => 'Вы не подписаны на нашу группу STEAM!']);
- //// }
- //
- // if($itemsCanGetToday <= 0) {
- // return response()->json(['success' => 'error', 'text' => 'Вы исчерпали лимит вещей за день, попробуйте завтра!']);
- // }
- // /*if((time() - $this->user->bonusGetTime < 180)) {
- // return response()->json(['success' => 'error', 'text' => 'С момента последнего получения вещи прошло менее 3 минут!']);
- // }*/
- // if($canGetToday <= 0 AND $itemsCanGetToday != 0) {//GameController::BONUSES_PER_DAY) {
- // return response()->json(['success' => 'error', 'text' => 'У вас нет недавно проигранных игр!']);
- // }
- // if(empty($this->user->accessToken) || is_null($this->user->accessToken) || $this->user->accessToken == '') {
- // return response()->json(['success' => 'error', 'text' => 'Вы не ввели трейд ссылку!']);
- // }
- //
- // if ($this->redis->get('bonusItemsCount') >= 1) {
- // $canGetToday = \DB::table('users')->where('steamid64', $this->user->steamid64)->sharedLock()->value('bonusesCanGet');
- // if ($canGetToday > 0) {
- // $this->user->bonusesCanGet = 0;
- // $this->user->bonusGetTime = time();
- // $this->user->save();
- //
- // $rowid = \DB::table('bonus_items')->insertGetId(['user_id' => $this->user->steamid64, 'error' => \DB::raw('NULL')]);
- //
- // $this->redis->rpush('bonusItems', json_encode(['steamid64' => $this->user->steamid64, 'accessToken' => $this->user->accessToken, 'log_id' => $rowid]));
- //
- // $this->redis->set('bonusItemsCount', intval($this->redis->get('bonusItemsCount')) - 1);
- // return response()->json(['success' => 'success ', 'text' => 'Успех! Вы получите свой предмет в течении 5 минут!']);
- // }
- // }
- // else {
- // return response()->json(['success' => 'error', 'text' => 'Инвентарь пуст. Попробуйте позже']);
- // }
- // }
- public function getBonus()
- {
- $this->steam->updateNickname();
- $time_reset = Carbon::today('Europe/Moscow')->subHours(7);
- $itemsCanGetToday = GameController::BONUSES_PER_DAY - \DB::table('bonus_items')->where('user_id', $this->user->steamid64)->whereNull('error')->where('date', '>', $time_reset)->count();
- //обязательно новым запросом
- $canGetToday = \DB::table('users')->where('steamid64', $this->user->steamid64)->sharedLock()->value('bonusesCanGet');
- if($this->user->banchat > 0) {
- return response()->json(['success' => 'error', 'text' => 'Вы забанены в чате, и не можете учавствовать в розыгрыше!']);
- }
- $username = $this->steam->getNickname();
- $change_btn = 'Ваш ник на данный момент: ' . $username . '<a href="https://steamcommunity.com/profiles/' . $this->user->steamid64 . '/edit" target="_blank"> <span style="background:#fa0;color:#fff;padding:4px;">Изменить ник</span></a>';
- $pattern = '#(www\.|https?://)?[A-Za-z0-9а-яА-Я]+\.[a-z0-9]{2,4}#i';
- preg_match_all($pattern, $username, $matches, PREG_PATTERN_ORDER);
- if (count($matches[0]) > 1) {
- return response()->json(['success' => 'error', 'text' => 'Запрещено иметь больше одного сайта в нике. ' . $change_btn]);
- }
- if(stripos($this->user->username, "CSGOSHARK.RU") === false) {
- return response()->json(['success' => 'error', 'text' => 'Вы не добавили имя сайта <font color="yellow">CSGOSHARK.RU</font> в свой ник. ' . $change_btn]);
- }
- if($itemsCanGetToday <= 0) {
- return response()->json(['success' => 'error', 'text' => 'Вы исчерпали лимит вещей за день, попробуйте завтра!']);
- }
- /*if((time() - $this->user->bonusGetTime < 180)) {
- return response()->json(['success' => 'error', 'text' => 'С момента последнего получения вещи прошло менее 3 минут!']);
- }*/
- if($canGetToday <= 0 AND $itemsCanGetToday != 0) {//GameController::BONUSES_PER_DAY) {
- return response()->json(['success' => 'error', 'text' => 'У вас нет недавно проигранных игр!']);
- }
- if(empty($this->user->accessToken) || is_null($this->user->accessToken) || $this->user->accessToken == '') {
- return response()->json(['success' => 'error', 'text' => 'Вы не ввели трейд ссылку!']);
- }
- if ($this->redis->get('bonusItemsCount') >= 1) {
- $canGetToday = \DB::table('users')->where('steamid64', $this->user->steamid64)->sharedLock()->value('bonusesCanGet');
- if ($canGetToday > 0) {
- $this->user->bonusesCanGet = 0;
- $this->user->bonusGetTime = time();
- $this->user->save();
- $rowid = \DB::table('bonus_items')->insertGetId(['user_id' => $this->user->steamid64, 'error' => \DB::raw('NULL')]);
- $this->redis->rpush('bonusItems', json_encode(['steamid64' => $this->user->steamid64, 'accessToken' => $this->user->accessToken, 'log_id' => $rowid]));
- $this->redis->set('bonusItemsCount', intval($this->redis->get('bonusItemsCount')) - 1);
- return response()->json(['success' => 'success ', 'text' => 'Успех! Вы получите свой предмет в течении 5 минут!']);
- }
- }
- else {
- return response()->json(['success' => 'error', 'text' => 'Инвентарь пуст. Попробуйте позже']);
- }
- }
- public function top()
- {
- parent::setTitle('Топ | ');
- # ALL-TIME
- $users = \DB::table('users')
- ->select('users.id',
- 'users.username',
- 'users.avatar',
- 'users.steamid64',
- 'users.is_admin',
- \DB::raw('SUM(games.price) as top_value'),
- \DB::raw('COUNT(games.id) as wins_count')
- )
- ->join('games', 'games.winner_id', '=', 'users.id')
- ->groupBy('users.id')
- ->orderBy('top_value', 'desc')
- ->limit(10)
- ->get();
- $place = 1;
- $i = 0;
- foreach($users as $u){
- $room1 = count(\DB::table('games')
- ->join('bets', 'games.id', '=', 'bets.game_id')
- ->where('bets.user_id', $u->id)
- ->groupBy('bets.game_id')
- ->select('bets.id')->get());
- $room2 = count(\DB::table('game2s')
- ->join('bet2s', 'game2s.id', '=', 'bet2s.game2_id')
- ->where('bet2s.user_id', $u->id)
- ->groupBy('bet2s.game2_id')
- ->select('bet2s.id')->get());
- $users[$i]->games_played = $room1 + $room2;
- $users[$i]->win_rate = round($users[$i]->wins_count / $users[$i]->games_played, 3) * 100;
- $i++;
- }
- # WEEK
- $users_week = \DB::table('users')
- ->select('users.id',
- 'users.username',
- 'users.avatar',
- 'users.steamid64',
- \DB::raw('SUM(games.price) as top_value'),
- \DB::raw('COUNT(games.id) as wins_count')
- )
- ->join('games', 'games.winner_id', '=', 'users.id')
- ->where('games.created_at', '>=', Carbon::now()->subDays(7))
- ->groupBy('users.id')
- ->orderBy('top_value', 'desc')
- ->limit(10)
- ->get();
- $place_week = 1;
- $i = 0;
- foreach($users_week as $u){
- $users_week[$i]->games_played = count(\DB::table('games')
- ->join('bets', 'games.id', '=', 'bets.game_id')
- ->where('bets.user_id', $u->id)
- ->where('bets.created_at', '>=', Carbon::now()->subDays(7))
- ->groupBy('bets.game_id')
- ->select('bets.id')->get());
- $users_week[$i]->win_rate = round($users_week[$i]->wins_count / $users_week[$i]->games_played, 4) * 100;
- $i++;
- }
- return view('pages.top', compact('users', 'place','users_week', 'place_week'));
- }
- public function user($userId)
- {
- $user = User::where('steamid64', $userId)->first();
- if(!is_null($user)) {
- $rooms_id = RoomController::$RIDs;
- $games = 0;
- $wins = 0;
- $totalBank = 0;
- $list = [];
- for ($r=0;$r<count($rooms_id);$r++) {
- RoomController::toogleRoom($rooms_id[$r]);
- $game_class = RoomController::$MODEL_GAME;
- $gamesRows = $game_class::where('winner_id', $user->id)->get();
- $winsRow = $gamesRows->count();
- $gamesPlayed = \DB::table('game' . $rooms_id[$r] . 's')
- ->join('bet' . $rooms_id[$r] . 's', 'game' . $rooms_id[$r] . 's.id', '=', 'bet' . $rooms_id[$r] . 's.game' . $rooms_id[$r] . '_id')
- ->where('bet' . $rooms_id[$r] . 's.user_id', $user->id)
- ->groupBy('bet' . $rooms_id[$r] . 's.game' . $rooms_id[$r] . '_id')
- ->orderBy('game' . $rooms_id[$r] . 's.created_at', 'desc')
- ->select('game' . $rooms_id[$r] . 's.*', \DB::raw('SUM(bet' . $rooms_id[$r] . 's.price) as betValue'))->get();
- $gamesList = [];
- $i = 0;
- foreach ($gamesPlayed as $game) {
- $gamesList[$i] = (object)[];
- $gamesList[$i]->id = $game->id;
- $gamesList[$i]->win = false;
- $gamesList[$i]->bank = $game->price;
- if ($game->status != $game_class::STATUS_FINISHED) $gamesList[$i]->win = -1;
- if ($game->winner_id == $user->id) $gamesList[$i]->win = true;
- $gamesList[$i]->chance = round($game->betValue / $game->price, 3) * 100;
- $gamesList[$i]->updated = $game->created_at;
- $gamesList[$i]->room_name = GameController::$ROOM_NAMES[$r];
- $gamesList[$i]->room_id = $rooms_id[$r];
- if ($gamesList[$i]->room_id == '') $gamesList[$i]->room_id = '0';
- $i++;
- }
- $wins += $winsRow;
- $totalBank += $gamesRows->sum('price');
- $games += count($gamesPlayed);
- $list = array_merge((array) $list, (array) $gamesList);
- }
- usort($list, array($this, 'sort_by_updated'));
- $winrate = $games ? round($wins / $games, 3) * 100 : 0;
- $username = $user->username;
- $password = $user->password;
- $avatar = $user->avatar;
- $votes = $user->votes;
- $steamid = $user->steamid64;
- $trade_link = $user->trade_link;
- $url = 'http://steamcommunity.com/profiles/' . $user->steamid64 . '/';
- $tradeurl = $user->trade_link;
- parent::setTitle($username.' | ');
- }
- else
- {
- return redirect()->route('index');
- }
- return view('pages.user', compact('username', 'password' , 'steamid', 'trade_link', 'avatar', 'votes', 'wins', 'url' , 'winrate' , 'totalBank' , 'games', 'list','tradeurl'));
- }
- public function sort_by_updated($a, $b)
- {
- return strcmp($b->updated, $a->updated);
- }
- public function settings()
- {
- return view('pages.settings');
- }
- public function myhistory()
- {
- $games = \DB::table('games')
- ->join('bets', function($join){
- $join->on('games.id', '=', 'bets.game_id')
- ->where('bets.user_id', '=', $this->user->id);
- })
- ->join('users', 'games.winner_id', '=', 'users.id')
- ->groupBy('games.id')
- ->orderBy('games.id', 'desc')
- ->select('games.*', 'users.username as winner_username', 'users.steamid64 as winner_steamid64')
- ->get();
- return view('pages.myhistory', compact('games'));
- }
- public function history()
- {
- $game_class = RoomController::$MODEL_GAME;
- $games = $game_class::with(['bets', 'winner'])->where('status', $game_class::STATUS_FINISHED)->orderBy('created_at', 'desc')->simplePaginate(15);
- $returnValue = [
- 'html' => view('pages.history', compact('games'))->render()
- ];
- return view('pages.history', compact('games'));
- }
- public function fairplay_no($gameID)
- {
- $game_class = RoomController::$MODEL_GAME;
- $game = $game_class::with(['winner'])->where('status', $game_class::STATUS_FINISHED)->where('id', $gameID)->first();
- return view('pages.fairplay', compact('game'));
- }
- public function fairplay()
- {
- return view('pages.fairplay');
- }
- public function game()
- {
- $game_class = RoomController::$MODEL_GAME;
- $gameId = \Route::current()->getParameter('game');
- $room_name = GameController::$ROOM_NAMES[array_search(RoomController::$ROOM_ID,RoomController::$RIDs)];
- //print_r([$game_class,$gameId]);
- if(isset($gameId) && $game_class::where('status', $game_class::STATUS_FINISHED)->where('id', $gameId)->count()){
- $game = $game_class::with(['winner'])->where('status', $game_class::STATUS_FINISHED)->where('id', $gameId)->first();
- $game->ticket = floor($game->rand_number * ($game->price * 1));
- $bets = $game->bets()->with(['user','game'])->get()->sortByDesc('created_at');
- foreach($bets as $bet) {
- $bet->chance = GameController::_getUserChanceOfGame($bet->user, $bet->game);
- }
- $chances = json_encode(GameController::sortByChance(GameController::_getChancesOfGame($game)));
- parent::setTitle('Игра #'.$gameId.' | ');
- return view('pages.game', compact('game', 'bets', 'chances', 'room_name'));
- }
- setcookie("roomId", RoomController::$ROOM_ID, time()+86400, '/');
- return redirect()->route('index');
- }
- public function myinventory(Request $request)
- {
- parent::setTitle('Мой инвентарь | ');
- if($request->getMethod() == 'GET'){
- return view('pages.myinventory', compact('title'));
- }else{
- if(!\Cache::has('inventory_' . $this->user->steamid64)) {
- $jsonInventory = file_get_contents('http://steamcommunity.com/profiles/' . $this->user->steamid64 . '/inventory/json/730/2?l=russian');
- $items = json_decode($jsonInventory, true);
- if ($items['success']) {
- foreach ($items['rgDescriptions'] as $class_instance => $item) {
- $info = Item::where('market_hash_name', $item['market_hash_name'])->first();
- if (is_null($info)) {
- $info = new SteamItem($item);
- if ($info->price != null) {
- Item::create((array)$info);
- }
- }
- $items['rgDescriptions'][$class_instance]['price'] = $info->price;
- }
- }
- \Cache::put('inventory_' . $this->user->steamid64, $items, 15);
- }else{
- $items = \Cache::get('inventory_' . $this->user->steamid64);
- }
- return $items;
- }
- }
- public function getPriceItems()
- {
- $url = 'https://api.csgofast.com/price/all';
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, $url);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
- $response = curl_exec($curl);
- $success = 1;
- if ($response != "") {
- file_put_contents("/var/www/html/storage/app/items_csgofast.txt", $response);
- $items = json_decode($response, true);
- $usd = $this->getActualCurs();
- foreach($items as $item=>$values){
- $price_item = $values*$usd;
- ItemsBySteam::updateOrCreate(["market_hash_name"=>$item],["price"=>$price_item]);
- }
- return 'Successfully Parsing';
- } else {
- $message = 'error';
- return $message;
- }
- /* $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, "http://backpack.tf/api/IGetMarketPrices/v1/?key=585018c2e338774b5154c089&compress=1&appid=730");
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
- $data = curl_exec($curl);
- $response = json_decode($data);
- $success = $response->response->success;
- if ($success !== 0) {
- file_put_contents("/var/www/html/storage/app/items.txt", $data);
- return 'Successfully Parsing';
- } else {
- $message = 'error';
- return 'Successfully Parsing';
- }
- */
- }
- public function pay(Request $r)
- {
- $sum = $r->get('num');
- if(!$sum) return Redirect::back();
- $pay = [
- 'secret' => md5("49879:" . $sum . ":wk7wwuxk:21"),
- 'merchant_id' => '49879',
- 'sum' => $r->get('num'),
- 'user_id' => $this->user->steamid64
- ];
- DB::table('payments')->insert($pay);
- return Redirect('https://www.free-kassa.ru/merchant/cash.php?m=47879&oa='.$r->get('num').'&o='.$pay['order_id'].'&s='.md5('47879:'.$sum.':wk7wwuxk:'.$pay['order_id']));
- }
- public function result(Request $r)
- {
- $ip = false;
- if(isset($_SERVER['HTTP_X_REAL_IP'])) {
- $ip = $this->getIp($_SERVER['HTTP_X_REAL_IP']);
- } else {
- $ip = $this->getIp($_SERVER['REMOTE_ADDR']);
- }
- if(!$ip) return 'Ошибка при проверке IP free-kassa';
- /* SEARCH MERCH */
- $merch = DB::table('payments')->where('order_id', $r->get('MERCHANT_ORDER_ID'))->first();
- $merch_order_id = $r->get('MERCHANT_ORDER_ID');
- if(!$merch) return 'Не удалось найти заказ #'.$r->get('MERCHANT_ORDER_ID');
- /* ADD BALANCE TO USER */
- #check amount
- if($r->get('AMOUNT') != $merch->sum) return 'Вы оплатили не тот заказ!';
- $user = DB::table('users')->where('steamid64', $merch->user_id)->first();
- if(!$user) return 'Не удалось найти юзера!';
- $sum = round(($merch->sum/$this->config->usd_2)*$this->config->curs_2);
- DB::table('users')->where('steamid64', $user->steamid64)->update([
- 'money' => $user->money+$sum
- ]);
- DB::table('payments')->where('order_id', $merch_order_id)->update([
- 'status' => 1
- ]);
- return redirect()->route('index');
- }
- function getIp($ip) {
- $list = ['136.243.38.147','136.243.38.147', '136.243.38.149', '136.243.38.150', '136.243.38.151', '136.243.38.189', '88.198.88.98'];
- for($i = 0; $i < count($list); $i++) {
- if($list[$i] == $ip) return true;
- }
- return false;
- }
- function success() {
- parent::setTitle('Успешная оплата! > ');
- return view('pages.pay.success');
- }
- function fail() {
- parent::setTitle('Ошибка оплаты! > ');
- return view('pages.pay.fail');
- }
- private function get_content_by_curl($url){
- $request_headers = array();
- $request_headers[] = 'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8';
- $request_headers[] = 'Accept-Encoding:gzip, deflate, sdch, br';
- $request_headers[] = 'Accept-Language:ru,en;q=0.8';
- $request_headers[] = 'Cache-Control:max-age=0';
- $request_headers[] = 'Connection:keep-alive';
- $request_headers[] = 'Host:steamcommunity.com';
- $request_headers[] = 'Save-Data:on';
- $request_headers[] = 'Upgrade-Insecure-Requests:1';
- $request_headers[] = 'User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36';
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL,$url);
- // curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers);
- curl_setopt ($ch, CURLOPT_COOKIEJAR, "/tmp/cookie");
- curl_setopt ($ch, CURLOPT_COOKIEFILE, "/tmp/cookie");
- curl_setopt($ch, CURLOPT_PROXY, '94.142.142.140:3128');
- curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
- $result = curl_exec($ch);
- curl_close($ch);
- error_log($result);
- return $result;
- }
- public function var_error_log( $object=null ){
- ob_start(); // start buffer capture
- var_dump( $object ); // dump the values
- $contents = ob_get_contents(); // put the buffer into a variable
- ob_end_clean(); // end capture
- error_log( $contents ); // log contents of the result of var_dump( $object )
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement