cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Problem retrieving javascript

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 30 Apr 2002 09:29:15 +0200 (MET DST)

On Mon, 29 Apr 2002 ZOVIRL_at_sbcglobal.net wrote:

[comments follow below]

> I am using the code from sample.c (included with libcurl, also available at
> http://curl.haxx.se/lxr/curl/docs/examples/simple.c). The only change I
> made to the code is to change the URL to point to www.google.com
>
> Now, here is the problem. When I load google in IE and look at the source,
> this snippet is near the bottom:

> <script>
> if (!hp.isHomePage('http://www.google.com/'))
> {document.write("<p><a href=\"/mgyhp.html\"
> onClick=\"style.behavior='url
> (#default#homepage)';setHomePage
> ('http://www.google.com/');\">Make Google Your
> Homepage!</a>");}
> </script>

> When I try to get the page from the sample program, however, this part of
> the page is not there. Why? Is libcurl dropping it? Is google sending a
> different page? How can I get that script to be included in the output
> from libcurl? Thanks!

libcurl doesn't drop anything (on purpose).

If the contents isn't there, it is most likely because the server didn't
include it. It might very well send you different contents depending who it
thinks you are. Try including a IE or Netscape-looking user-agent field to
see if that can fool it to return the javascript for you.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2002-04-30