cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to click a button on a website using libcurl?

From: Jeff Pohlmeyer <yetanothergeek_at_gmail.com>
Date: Wed, 25 Aug 2010 13:32:08 -0500

On 2010/8/25 WiZaRd wrote:

> I am using libcurl in a C++ application and I encountered a problem
> that I couldn't solve by reading libcurls docs, searching the net and
> trying around.
> I want to visit a site that dynamically enables a "Download" button after
> some time (similar to a lot of filehosters). After waiting my turn and
> re-visiting the site, I get a
>  ...
> How can I simulate a "click" onto the "download" button to retrieve the
> URL that's needed to download the file?! I managed to handle forms
> but I fail to see what URL and parameters to pass to curl_easy_perform.

I don't know much about ajax, but it looks like this page is using it,
along with some additional javascript - e.g. I don't think do_request()
is a built-in JS function and I don't see it defined anywhere here.

Unless you want to analyze all the little tricks the script is using, it
might be easier to install the "LiveHTTPHeaders" extension for Firefox
and have a peek at the the outgoing headers, maybe that will give you
enough information to simulate the request with libcurl.

It seems like this site put a lot of effort into preventing automated
downloads, so it will probably take a lot of effort to subvert that
protection.

- Jeff
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-08-25