Use a cookie stored in a text file, fetch page with cookie & Curl and pregmatch text

Discussion in 'PHP' started by rudeturk, May 31, 2008.

  1. #1
    Yep just like i said in the title.
    Can someone Please help me make this function im doing an experiment.

    For Example, Lets say the page i want to read normally says:

    <html>
    <body>
    Hello you are not logged in
    <body>
    </html>
    HTML:
    But with my cookie it says:
    <html>
    <body>
    logged in, url is <a href="http://www.google.com">this</a>
    </body>
    <html>
    HTML:
    I want to use curl or php to get file contents with my cookie, get the url http://www.google.com preg_match and then return it.
    Well i know how to do this using php's getfilecontents function but i cant use my cookie i think and i saw that with curl you can.

    Can anybody help me by making an example function please?, its realy urgent:(
    Thanks in advance to all Digitalpoint users!
     
    rudeturk, May 31, 2008 IP
  2. CodyRo

    CodyRo Peon

    Messages:
    365
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You're right, cURL is going to be the key here. Namely the curl_setopt() function and the "CURLOPT_COOKIEFILE" option to point to the cookie you want to use :).
     
    CodyRo, May 31, 2008 IP
  3. rudeturk

    rudeturk Well-Known Member

    Messages:
    884
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    120
    #3
    Thanks but can anyone give me an example function and an example cookie file on how its used etc?
     
    rudeturk, Jun 1, 2008 IP