curl-library
Re: Problem retrieving javascript
Date: Fri, 22 Nov 2002 14:25:38 +0800
> 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!
Odds are Google is checking the user agent header string and returning a different page. Adding favourites is one of those things
that's done differently in each browser, IIRC.
I have a dumper script at http://ii.net/~locust/dumpenv.cgi that should reveal what agent info you're sending. IE6 on my machine
yields:
HTTP_USER_AGENT=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Wheras a (slighly dated) version of curl on a FreeBSD machine gives me:
HTTP_USER_AGENT=curl/7.9.2 (i386--freebsd4.4) libcurl 7.9.2 (OpenSSL 0.9.6a)
If you really wanted to pretend to be IE6, you could do something like this:
curl_easy_setopt(curlHandle, CURL_USERAGENT,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
-- Andrew Francis Software Developer Family Health Network ----- Original Message ----- From: <ZOVIRL_at_sbcglobal.net> To: <curl-library_at_lists.sourceforge.net> Sent: Tuesday, April 30, 2002 6:55 AM Subject: Problem retrieving javascript > Libcurl is a great tool, but I'm having some trouble > getting it to work with Javascript. What I am posting > here is a distilled version of my problem. Hopefully, > someone will know what I am missing. > > 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! > > > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sfReceived on 2002-11-22