1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

fake user agent

Discussion in 'PHP & Perl' started by mylikes786, Feb 1, 2014.

  1. mylikes786

    mylikes786 Registered Member

    Joined:
    Oct 31, 2013
    Messages:
    80
    Likes Received:
    6
    As my title how can i spoof user agentusing php
    There are some addon available for firefox or chrome to change user agent

    but i want do this in php code so my all site load and show look of that any user agent

    How can i do this
     
  2. rutix

    rutix Junior Member

    Joined:
    Sep 6, 2012
    Messages:
    102
    Likes Received:
    12
    Last edited: Feb 1, 2014
  3. mylikes786

    mylikes786 Registered Member

    Joined:
    Oct 31, 2013
    Messages:
    80
    Likes Received:
    6
    <?
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://mysite.com");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_USERAGENT,'NokiaN70-1/1.0526.0.1 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1');
    $data = curl_exec($ch);
    curl_close($ch);
    ?>

    <?
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://mysite.com");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_USERAGENT,'NokiaN70-1/1.0526.0.1 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1');
    $data = curl_exec($ch);
    curl_close($ch);
    ?>

    it show blank page :/



    it show blank page :/
     
  4. rutix

    rutix Junior Member

    Joined:
    Sep 6, 2012
    Messages:
    102
    Likes Received:
    12
    how do you mean "it shows blank page"?

    the response is saved in $data, so you will need to: