473,326 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

read cgi response

Hi Group
I need to parse a response from a cgi script. The response is te
following:
<HTML>UID=834<HTML>
the call for the cgi is http://<server>/cgi-bin/getuid?FILE=uid.html

Now I need the UID in a javascript.
1) call cgi
2) put UID into a variable

How do I have to do that? If I call the cgi the response will be
displayed on the screen but I just need it in the variable.
Thanks for any help.

Michael

Jul 10 '07 #1
2 3530
Mitschu wrote:
Hi Group
I need to parse a response from a cgi script. The response is te
following:
<HTML>UID=834<HTML>
the call for the cgi is http://<server>/cgi-bin/getuid?FILE=uid.html

Now I need the UID in a javascript.
1) call cgi
2) put UID into a variable

How do I have to do that? If I call the cgi the response will be
displayed on the screen but I just need it in the variable.
Thanks for any help.
My name is not Group. My name is -Lost. Nice to meet you, Michael.

Anyway...

Your server-side script would need to produce the output, which in your
case is a JavaScript variable.

Assuming Perl, you could:

print 'var ' . $cgi->param('UID') . ';';

*OR*

print 'var ' . param('UID') . ';';

This assumes you have sent an appropriate Content-Type and are using the
CGI module.

Anyway, if you have further CGI questions, you might try comp.lang.perl.misc

I don't know of any CGI groups offhand.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Jul 10 '07 #2
Mitschu wrote on 10 jul 2007 in comp.lang.javascript:
Hi Group
I need to parse a response from a cgi script. The response is te
following:
<HTML>UID=834<HTML>
the call for the cgi is http://<server>/cgi-bin/getuid?FILE=uid.html

Now I need the UID in a javascript.
1) call cgi
2) put UID into a variable

How do I have to do that? If I call the cgi the response will be
displayed on the screen but I just need it in the variable.
Thanks for any help.
Use AJAX like technology:

var http = new ActiveXObject("Msxml2.XMLHTTP");
// look for more Cross browser friendly code, this is IE only

function getUrl(url) {
http.open("GET",url,false);
http.send();
return http.responseText;
}
or use a serverside equivalent,
and patch the result in the clientside js code:

var myString = '<%= resultString %>';

<% ' vbscript
Set http = Server.CreateObject("Microsoft.XMLHTTP")
function getUrl(url)
........................
%>

or maybe this works, not tested!:

<script language='jscript' runat='server'>
var http = new ActiveXObject('Microsoft.XMLHTTP');
function getUrl(url) {
http.open("GET",url,false);
http.send();
return http.responseText;
}
</script>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 10 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Marcin Ciura | last post by:
I have the following problem with HTTPResponse: import httplib #, select .... connection = httplib.HTTPConnection(host) connection.connect() connection.request('GET', url) response =...
3
by: Doug | last post by:
Working on converting an Access front-end/SQL Server back-end to a .NET front/SQL Server back-end. We are also redesiging the SQL Server database. We have many Word/Excel documents that have...
1
by: oni | last post by:
hi all, the program should be able to log on to a pop mail account and need to just read its headers and display. any help in this regard highly apperecialted. code pref VB.NET thankz in...
3
by: jamal | last post by:
HI guys I want to make a program that will read my external pop3 e-mail account and save them to an access/sql file on my workstation. what you guys think ? Can I make something like this with...
1
by: Arpan | last post by:
The contents of a text file are as follows: The Quick Brown Fox Jumped Over The Lazy Dog. Note that there isn't any space at the end of each of the 3 lines. Now when I do this:
4
by: Kuldeep | last post by:
Hi All, I am trying to read the contents of a page through its URL. My code snippet is as follows: public void mtdGetPageDataHWR() { HttpWebRequest objRequ =...
2
by: Jack | last post by:
Hi, I want to read a string a chars from a stream, and put it into a string. At the moment, I'm creating a buffer of a fixed size, and reading the stream of text into it. It works, but I have...
0
by: vishnu | last post by:
Hi, Am trying to post the data over https and am getting error in httpwebresponse.getResponseStream.Please help me to get rid of this issue. Here is the message from immediate window ...
1
Oodles Of Noodles
by: Oodles Of Noodles | last post by:
Hello fellow geeks I have a problem in my database iVB .Net program that is generating 'Error:Invalid attempt to read when no data is present.' The weird part is that when you call the page from...
3
by: =?Utf-8?B?VHJlY2l1cw==?= | last post by:
Hello, Newsgroupians: I'm creating an application that will read emails from GMail, using the System.Net.Sockets.TcpClient and POP protocol. However, I am having a problem with my SslStream. ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.