cgi scripting

andu undo at cloud9.net
Thu Jan 30 15:14:01 EST 2003


--On Thursday, January 30, 2003 11:43:26 -0800 RCS <rcs at rcsprogramming.com> 
wrote:

> Thanks Andu...here is the 'analyzed' packet from the device to the server
> (I used CommView...minus the hex info):
>
> GET /cgi/input.cgi?INPUT=RGB1&lang=e&x=39&y=11 HTTP/1.0..Accept:
> image/gif , image/x-xbitmap, image/jpeg, image/pjpeg, application/msword,
> */*..Referer: http://192.168.4.9/base_e.htm..Accept-Language:
> en-us..User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)..Host:
> 192.168.4.9..Connection:  Keep-Alive....

Try something like this:

put "INPUT=RGB1&lang=e&x=39&y=11" into tData

put "POST /cgi/input.cgi HTTP/1.0" & crlf &\
	"Accept: */*" & crlf &\
	"Accept-Language: en-us" & crlf &\
	"Connection: Keep-Alive" & crlf &\
	"User-Agent: Metacard-Tool" & crlf &\
	"Content-Length: " & length(tData) & \
	crlf & crlf & tData into tRequest
write tRequest to socket x

Post is the correct way to do it. You get the idea, each line of the header 
is separated by crlf and you have crlf & crlf between the header and the 
content, that's the standard. If you still get errors play with the above 
or  repost to the list

>
> ('INPUT=RGB1' is the actual 'command' or syntax)
>
>
> The server responds with :
>
> HTTP/1.0 2 OK..Server: Dahlia/1.0.9a..Connection: Keep-Alive..
>
> And the very next packet is:
>
> Content-Type: text/html....<html><BODY
> onLoad="setTimeout('history.go(-1)',1)"></BODY></html>
>
>
> When I try to send this information, the server responds, but instead of
> 'OK', there is an 'ERROR 400' or something...and obviously it does not do
> anything to the device.
>
>
> I hope this makes sense...
>
> (This is a web browser based interface to get the status of a device on
> the network...from IE or Netscape, etc.).
>
>
> Thanks,
> John (RCS)
>
>
>> --On Wednesday, January 29, 2003 11:18:34 -0800 RCS
>> <rcs at rcsprogramming.com> wrote:
>>
>> > Hello,
>> >
>> > I just thought I would post this in the hopes that someone has already
>> > worked this out:
>> >
>> >   I need to respond to a device that has a simple server (a network
>> > appliance). The server needs to be 'fed' cgi responses (i.e. GET or
> POST),
>> > and I have 'analyzed' the device that I am trying to emulate for the
>> > format (basically a web interface from within a browser). I have the
>> > format that the device is sending, but it has information embedded that
> I
>> > do not think is relevant to me (referrer: Mozilla, etc.). So when I
>> > simply send this 'GET' command from an open socket (port 80) from
>> > MetaCard, I get a response from the server, but it tells me there is an
>> > error in the format.
>> >
>> >   I suppose my question is: when replying to a server in this
> manner...who
>> > should I say the referrer is? Do I need this? I know I need to read up
> on
>> > cgi scripting, but I thought this might be a simple procedure...
>>
>> It is simple when you know it, why don't you post what exactly the server
>> sends and what your script replies, you give no "helpful" information.
>>
>> >
>> > Thanks for any info,
>> > RCS
>> >
>> > _______________________________________________
>> > metacard mailing list
>> > metacard at lists.runrev.com
>> > http://lists.runrev.com/mailman/listinfo/metacard
>> >
>>
>>
>>
>> Regards, Andu Novac
>>
>
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard
>



Regards, Andu Novac



More information about the metacard mailing list