cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: javascript

From: Legolas <legolas558_at_email.it>
Date: Wed, 22 Mar 2006 15:10:18 +0100

You should better inform about javascript and browsers before stating
"send a javascript command" since it means nothing unless you have
something that will receive the command. That "something" is the
javascript interpreter, usually the web browser, and curl does not have
it since it simply parses HTTP requests in this case. Javascript code is
simply an HTML tag for curl.
If you are able to, you should integrate Mozilla Spidermonkey (actually
a "piece" of web browser), else you may try to write a parser to process
the javascript snippet of code you're focusing on (e.g. processing a
document.location reference in the page). This would be a derty job and
absolutely not widely compatible.

Richard ha scritto:

>Ralph,
>
>What i'm looking to do is go to a website and send a
>javascript command.
>
>
You would better have written: navigate through a website and execute
its client javascript code

>
>for example go to : http://www.blah.com
>and do the command javascript:blah;
>
>--- Ralph Mitchell <ralphmitchell_at_gmail.com> wrote:
>
>
>
>>What do you mean by "send javascript commands"??
>>
>>I had some success back in 2002 using Mozilla's
>>Spidermonkey
>>javascript engine to process a proxy autoconfig file
>>to decide whether
>>to use a proxy or not. I used curl to grab the
>>autoconfig file from
>>the server, tacked on a small block of required
>>functions and pushed
>>it through js. The result was either "DIRECT" or
>>the name of the
>>proxy to use.
>>
>>If you're hoping to process a web page and "do the
>>right thing" for
>>the javascript it contains, there's a *lot* more
>>work involved. You'd
>>probably end up writing a large fraction of a web
>>browser to be able
>>to handle all the javascript that could show up.
>>
>>Ralph Mitchell
>>
>>
>>On 3/22/06, Richard <antonyjones101_at_yahoo.com>
>>wrote:
>>
>>
>>>Hi Kjell,
>>>
>>>Thanks for the quick reply!
>>>
>>>That's a bit of a shame as being able to send
>>>javascript commands would simplify my life
>>>
>>>
>>immensely!
>>
>>
>>>Is there nothing out there at all that could be
>>>
>>>
>>used
>>
>>
>>>alongside libcurl to send javascript commands?
>>>
>>>
>>>--- Kjell Ericson <Kjell.Ericson_at_haxx.se> wrote:
>>>
>>>
>>>
>>>>On Wed, 22 Mar 2006, Richard wrote:
>>>>
>>>>
>>>>
>>>>>I know that the faq of libcurl says that
>>>>>
>>>>>
>>>>javascript isn't possible with
>>>>
>>>>
>>>>>libcurl but was wondering if there had been
>>>>>
>>>>>
>>any
>>
>>
>>>>sort of add ons written
>>>>
>>>>
>>>>>since that was published to allow javascript
>>>>>
>>>>>
>>>>commands to be used with
>>>>
>>>>
>>>>>libcurl?
>>>>>
>>>>>
>>>>No.
>>>>
>>>>That is quite extensive work and I don't think
>>>>anyone will do it within many
>>>>years. I missed it sometimes myself, but when
>>>>getting down to ground I don't
>>>>really know what curl should do with the
>>>>javascripts.
>>>>It would be better to have a separate library
>>>>handling javascripts and with a
>>>>callback requests new web data.
>>>>
>>>>That new library could ofcourse use libcurl, but
>>>>libcurl will probably never
>>>>handle javascript itself.
>>>>
>>>> // Kjell
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>>
>___________________________________________________________
>
>
>>>Win a BlackBerry device from O2 with Yahoo!. Enter
>>>
>>>
>>now. http://www.yahoo.co.uk/blackberry
>>
>>
>>
>>
>
>
>
>
>
>
>___________________________________________________________
>Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com
>
>
>
Received on 2006-03-22