PHP accept cookies?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ReGenesis0@aol.com

    PHP accept cookies?

    Okay, so I want to do this THANG, which involves some fairly ugly
    screenscraping since it's a mashup with another site that doesn't have
    friendly, mashable, controls.

    Problem- I need to log into the site from a PHP script- and when I
    send my login info, it responds with the following:

    Download the Flash plugin.
    You must have cookies enabled to use the site. Please enable cookies
    and click here.

    The possible causes of this problem are:

    * Your browser is setup to block cookies.
    * Your firewall is setup to block cookies.
    * Your AntiVirus program is setup to block cookies.

    I gather the server is using something to test for flash, and then
    settignt he appropriate cookie. I don't care about the flash- all i
    need is the HTML on the next page. So how do I accept its cookie so
    that I can scrape this?

    (Ironically, none of this is strictly necessary for the mashup- but I
    have to do this part to verify login names in order to keep users from
    messing with other users' accounts. Clearly I am a saint for enduring
    this unnecessary suffering.)

    -Derik

  • Edward Z. Yang

    #2
    Re: PHP accept cookies?

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    ReGenesis0@aol. com wrote:
    Problem- I need to log into the site from a PHP script- and when I
    send my login info, it responds with the following:
    If you are using cURL, use curl_setopt()
    http://us2.php.net/manual/en/function.curl-setopt.php with
    CURLOPT_COOKIEJ AR and CURLOPT_COOKIEF ILE to ensure cookies sent back get
    carried over.

    You can also use a PHP browser emulator like SimpleTest to get similar
    functionality.

    - --
    Edward Z. Yang GnuPG: 0x869C48DA
    HTML Purifier <htmlpurifier.o rg Anti-XSS HTML Filter
    [[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.6 (MingW32)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

    iD8DBQFGXijZqTO +fYacSNoRAi/IAJ9jW5zS/eVbl5iZ/Ha7XD7dvH/YZACfX+z3
    gw+wQFxi5UhjWB8 MAgs5Wl4=
    =rkpC
    -----END PGP SIGNATURE-----

    Comment

    • yawnmoth

      #3
      Re: PHP accept cookies?

      On May 30, 8:46 pm, "Edward Z. Yang" <edwardzy...@th ewritingpot.com >
      wrote:
      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA1
      >
      ReGenes...@aol. com wrote:
      Problem- I need to log into the site from a PHP script- and when I
      send my login info, it responds with the following:
      >
      If you are using cURL, use curl_setopt()http://us2.php.net/manual/en/functio...setopt.phpwith
      CURLOPT_COOKIEJ AR and CURLOPT_COOKIEF ILE to ensure cookies sent back get
      carried over.
      >
      You can also use a PHP browser emulator like SimpleTest to get similar
      functionality.
      Although I can't say, for sure, I suspect the problem may be more
      complicated then that.

      What if the cookies aren't being set with HTTP headers but rather,
      with javascript? cURL won't catch them, then, and unless SimpleTest
      has a full blown javascript parser, I doubt it will, either.

      So what if the Flash file, itself, is setting the cookies?

      Well, I guess you could always decode the Flash file and create your
      own "cookiejar" from that...

      The Flash specifications are available here:



      (scroll down to "Macromedia Flash (SWF) and Flash Video (FLV) File
      Format Specification (Version 8)")

      Comment

      • Edward Z. Yang

        #4
        Re: PHP accept cookies?

        -----BEGIN PGP SIGNED MESSAGE-----
        Hash: SHA1

        yawnmoth wrote:
        Although I can't say, for sure, I suspect the problem may be more
        complicated then that. [snip]
        If that is indeed the case, I would throw up my hands and give up. It
        should be fairly simple to determine with a little request tampering on
        the site.

        - --
        Edward Z. Yang GnuPG: 0x869C48DA
        HTML Purifier <htmlpurifier.o rg Anti-XSS HTML Filter
        [[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]
        -----BEGIN PGP SIGNATURE-----
        Version: GnuPG v1.4.6 (MingW32)
        Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

        iD8DBQFGXjhdqTO +fYacSNoRAusTAJ 0eV4oAINexvp0IX SVZhdWiqmwaTACf ZH7J
        RMAj4wF+4qJQPXb ywCQfwbI=
        =3x+v
        -----END PGP SIGNATURE-----

        Comment

        Working...