<?php
define('_BrowserCookiePath','rData/BrowserCookie.txt');
define('_BrowserTimeOut',20);
define('_BrowserFileTimeOut',300);

/*
 * Browser Options $aBrowser[option]
 * options:
 * aHttp = Http param
 * sUa = UserAgent
 *
 * after using the function Browse()
 * options:
 * su = last visited url
 * suReferrer = lat referrer
 */
$aBrowser['aHttp'] = array(
    'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
    'Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3',
	'Accept-Encoding: ',
    'Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7',
	'Keep-Alive: 300',
	'Connection: keep-alive'
);
//Accept-Encoding: \n  need for nogzip http

$aBrowser['sUa'] = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.12';
$aBrowser['sfBrowserCookie'] = _BrowserCookiePath; // path to save cookie
$aBrowser['iBrowserTimeOut'] = _BrowserTimeOut;
$aBrowser['iBrowserFileTimeOut'] = _BrowserFileTimeOut;
$aBrowser['sCookie'] = '';
$aBrowser['iLocation'] = 0;
$aBrowser['suLocation'] = '';

function BrowserUa($k){
    global $aBrowser;

    $a['firefox'] = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.12';
    $a['ie'] = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)';
    $a['opera'] = 'Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.6.30 Version/10.61';
    $a['nokia'] = 'Mozilla/4.0 (compatible; MSIE 6.0; Symbian OS; Nokia 6630/4.03.38; 6937) Opera 8.50';
    $a['alexa'] = 'ia_archiver';
    $a['baidu'] = 'Baiduspider (+http://www.baidu.com/search/spider.htm)';
    $a['google'] = 'Mozilla/5.0 (compatible; googlebot/2.1; +http://www.google.com/bot.html)';

    if('rand' == $k){
        shuffle($a);
        $aBrowser['sUa'] = 'User-Agent: '.array_pop($a);

    }
    if(isset($a[$k])) $aBrowser['sUa'] = 'User-Agent: '.$a[$k];

    return  $aBrowser['sUa'];
}


