proxy problem

Discussion in 'PHP' started by 007c, Feb 9, 2008.

  1. #1
    Hi i'm setting a proxy on my server using phpproxy i'm probly going to be installing squid too. However i hit a small problem my server is in nl but if i use the script some sites will default to that regions language, i'm guessing this happens for other countries too. Is there a way to fix it so all sites default to a specific language? Maybe with http headers?
    So far i only tried:

    
        $_request_headers  = $_request_method . ' ' . $_url_parts['path'];
    
        if (isset($_url_parts['query']))
        {
            $_request_headers .= '?';
            $query = preg_split('#([&;])#', $_url_parts['query'], -1, PREG_SPLIT_DELIM_CAPTURE);
            for ($i = 0, $count = count($query); $i < $count; $_request_headers .= implode('=', array_map('urlencode', array_map('urldecode', explode('=', $query[$i])))) . (isset($query[++$i]) ? $query[$i] : ''), $i++);
        }
    
        $_request_headers .= " HTTP/1.0\r\n";
        $_request_headers .= 'Host: ' . $_url_parts['host'] . $_url_parts['port_ext'] . "\r\n";
    
        if (isset($_SERVER['HTTP_USER_AGENT']))
        {
            $_request_headers .= "User-Agent: Mozilla/5.0 (X11; U; Linux i686; [COLOR="Lime"]en-US[/COLOR]; rv:1.8.1.10pre) Gecko/20071117 Firefox/2.0.0.10pre (Swiftfox)\r\n"; //$_request_headers .= 'User-Agent: ' . $_SERVER['HTTP_USER_AGENT'] . "\r\n";
        }
        if (isset($_SERVER['HTTP_ACCEPT']))
        {
            $_request_headers .= 'Accept: ' . $_SERVER['HTTP_ACCEPT'] . "\r\n";
        }
        else
        {
            $_request_headers .= "Accept: */*;q=0.1\r\n";
        }
        if ($_flags['show_referer'] && isset($_SERVER['HTTP_REFERER']) && preg_match('#^\Q' . $_script_url . '?' . $_config['url_var_name'] . '=\E([^&]+)#', $_SERVER['HTTP_REFERER'], $matches))
        {
            $_request_headers .= 'Referer: ' . decode_url($matches[1]) . "\r\n";
        }
    
    Code (markup):
    Maybe i need some type of cookie handler or HTTP_ACCEPT_LANGUAGE ?

    Any help would be a preciated.
     
    007c, Feb 9, 2008 IP
  2. Cybernaut

    Cybernaut Peon

    Messages:
    408
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You need to use a proxy that is located in an English country (en-US?) (difficult), or get a server that is located in an English country (easy). User-Agent or Accept-Language will not work (mostly) because sites normally use the remote IP address to determine location and language.
     
    Cybernaut, Feb 9, 2008 IP