Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Using socket code / no browser to issue a Javascript event

Reply
Thread Tools

Using socket code / no browser to issue a Javascript event

 
 
Nathan DeBardeleben
Guest
Posts: n/a
 
      10-20-2004
This may seem wierd, and I know someone asked this question before but
was told they were doing it the hard way. Unlike them, I do not have
shell access to the machine where this javascript runs.

I need to run the 'submit' method on a Javascript on a page - but I
need to do it without a browser. I can handle all the socket code,
that's not the issue, the issue is what command I need to send. I
should be able to hit the page and issue it's functionality just like
I could with a wget or by pasting a CGI with its actions into a
browser window.

Ideas?

Here's the snippet of the method I need to call - nothing special at
all.

<form name="click" action="mysite/cgi-bin/my.cgi" method="POST">
<input type="hidden" name="ses" value="366021079">
<input type="hidden" name="id" value="somevalue">
<script language="JavaScript">
<!--
document.write('<a href="javascript:document.click.submit()"><img
src="/images/img.gif" width=290 height=73 alt="alt text"
border=0></a>');
//-->
</script>

<noscript>
<input type="submit" value="Submit">
</noscript>
</form>

The browser, if I use that lists the link as:
javascript:document.click.submit().
I need to call that method remotely.
I know all the above values - that's not the issue - I just need to
find a way to make it execute the submit() function where I can pass
in the variables. I know in CGI I could do things like
.....cgi&value="foo"&value2="bar", etc.

Thanks in advance.
 
Reply With Quote
 
 
 
 
Philip Ronan
Guest
Posts: n/a
 
      10-20-2004
Nathan DeBardeleben wrote:

> This may seem wierd, and I know someone asked this question before but
> was told they were doing it the hard way. Unlike them, I do not have
> shell access to the machine where this javascript runs.
>
> I need to run the 'submit' method on a Javascript on a page - but I
> need to do it without a browser.


Yes, that sounds weird.

> I can handle all the socket code,
> that's not the issue, the issue is what command I need to send.


You lost me there. You want to run Javascript in a browser that doesn't
exist, and you want to know what command to send it?

Do you mean you want to simulate the submission of this form? You can do
that by sending out the appropriate headers with the form values in the body
of the request:

>> POST /cgi-bin/my.cgi HTTP/1.1
>> Host: mysite
>> Content-Type: application/x-www-form-urlencoded
>> Content-Length: [work it out]
>>
>> ses=366021079
>> id=somevalue


Not really a Javascript issue though, so perhaps I've totally misunderstood
your problem.

--
Philip Ronan

(Please remove the "z"s if replying by email)


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Steve Holden Python 1 02-03-2009 06:20 AM
Re: socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Steve Holden Python 0 02-01-2009 12:45 PM
Re: socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Laszlo Nagy Python 0 02-01-2009 07:37 AM
socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Laszlo Nagy Python 1 01-27-2009 05:05 PM
Re: socket.unbind or socket.unlisten? - socket.error: (48,'Address already in use') Jean-Paul Calderone Python 0 01-27-2009 01:41 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57