[CURL] Fake JS and Cookies Enabled

Discussion in 'PHP' started by ColorWP.com, May 19, 2011.

  1. #1
    Hello.

    I am trying to get the page title of the following video's page using this CURL function:
    http://tinyurl.com/6duttha

    I use CURL to grab the whole page's content and then filter what's inside the <title> tags.

    However, the site checks if you have cookies and javascript enabled, otherwise it redirects to a page with a message saying that either of these two is not enabled.

    I figured that I can fake the cookie using the following:
    $cookie = "checkCookies=yes;TestIfCookie=ok;TestIfCookieP=ok";
    curl_setopt($ch, CURLOPT_COOKIE, $cookie);
    PHP:
    However, I can't fake javascript enabled browser. Do you know how I can fake it with CURL so I can access the video page's title at least?

    Regards!
     
    ColorWP.com, May 19, 2011 IP
  2. ruvenf

    ruvenf Peon

    Messages:
    19
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    ruvenf, May 19, 2011 IP
  3. ColorWP.com

    ColorWP.com Notable Member

    Messages:
    3,121
    Likes Received:
    100
    Best Answers:
    1
    Trophy Points:
    270
    #3
    ruvenf: That's a PHP script to check if it's enabled. I need a solution to fake that it's enabled, because the CURL library is not a full-featured browser, and thus it doesn't contain a javascript parser.
     
    ColorWP.com, May 20, 2011 IP
  4. runbrun11

    runbrun11 Member

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    38
    #4
    Try using the user agent property.

    useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
    curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
    Code (markup):
     
    runbrun11, May 22, 2011 IP
  5. ColorWP.com

    ColorWP.com Notable Member

    Messages:
    3,121
    Likes Received:
    100
    Best Answers:
    1
    Trophy Points:
    270
    #5
    Setting user agent didn't work. I've tried simulating a Google bot spider too...
     
    ColorWP.com, May 23, 2011 IP