Hi all,
Is it possible to scrape content from an iframe with curl?

    why not just file_get_contents(url_of_iframe)

    I tryed that but the iframe page is from a cgi script and I get a blank page. I think I need some kind of validation?

      you can't scrape the contents of an iframe from the html page containing it, you'd have to parse out the iframe url and then call it directly.
      If it has some sort of authentication, it should be possible to duplicate it with curl, but that's a whole 'nother thing, and you'd want to look up the curl docs on session management for that.

        If you have firefox, you can right-click the iframe and select 'view frame info' where you can get the url of the iframe. Try fetching that instead.

        If you cannot, you may need to create some kind of multi-page fetching script where you use curl to fetch the first cage (with options set to permit storage of cookies) and then look for the iframe in that page using preg_match or something and then fetch the second page, providing the cookies placed by the first page.

        curl handles it quite nicely if you set the cookie options.

          I would do this:

          -CURL into the page holding the iframe
          -Parse that page with DOM to get the src attribute of the iframe element
          -CURL into that src
          -Do whatever you need with the resultant data

          If the iframe source is static then you only need todo the bottom two steps

            Write a Reply...