A proxy that works with facebook

Discussion in 'PHP' started by Tomp, Sep 6, 2007.

  1. #1
    Its getting a bit annoying all these proxy sites that dont work with facebook, or only slightly work with facebook, does anyone know what would be needed to write, or modify a proxy script that would work fully with facebook. What are the problems that are being encountered by these proxys that are causing parts of the site to not work?

    Tom
     
    Tomp, Sep 6, 2007 IP
  2. bgillingham

    bgillingham Peon

    Messages:
    109
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think that it has a lot to do with how the proxy makes it's request for the page content before serving it up ... Specifically, the request needs to come from a valid "User-Agent" value.

    This is a snippet of code that I use in my 2WebSurf web app. Could you let me know if some part of my site does not handle facebook? Please visit http://2websurf.com/viewer.php which is a sort-of screensaver for your browser... in the event that you want the browser to hide what you've been viewing as well as to display something like Google after a given time period.

    function _get_contents($url) {
    $opts = array(
    'http'=>array(
    'method'=>"GET",
    'timeout' => 3,
    'header'=>"Accept-language: en\r\n" .
    "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)\r\n"
    )
    );

    $context = stream_context_create($opts);

    $file = '';
    // Open the file using the HTTP headers set above
    $file = trim(file_get_contents($url, false, $context));

    if ($file=='') {
    $file = file_get_contents($url);
    }
    return $file;
    }
     
    bgillingham, Feb 17, 2010 IP