Running a perl script from an ASP page to include QUERY_STRING

B

benwylie

I am running IIS 6.0 on Windows 2003.

I would like to be able to run a perl script from a web page and
include the output.
I have tried doing it with an ssi:
<form action='docsearch.shtml' method='get'>
<!--#exec cgi="/cgi-bin/docsearch.pl-->
</form>

This correctly ran the script, but it was unable to include the
QUERY_STRING from the parent URL into the included perl script, and
there seems no work around to enable me to do that on IIS 6.0,
therefore on this thread:
http://groups.google.com/group/microsoft.public.inetserver.iis/browse_thread/thread/76ae0d85395a3d72
I was recommended: "to a simple ASP page which will easily do exactly
what you want because it actually has the functionality you want, by
intention, and is supported."

That is now what I am attempting to do. I found this page:
http://www.wrensoft.com/zoom/support/faq_ssi.html
which recommends using this to run the script:
<%
Dim WshShell, env
Set WshShell = CreateObject("WScript.Shell")
Set env = WshShell.Environment("Process")
env.Item("REQUEST_METHOD") = "GET"
env.Item("QUERY_STRING") = Request.QueryString
set oExec = WshShell.Exec(Server.MapPath("search.cgi"))
oExec.StdOut.ReadLine() ' skip the HTTP header line
Response.Write(oExec.StdOut.ReadAll())
%>
However, when I do this, I get an error message:
WshShell.Exec error '800700c1'
docsearch.pl is not a valid Win32 application.

How can I run a perl script file, ensuring that it receives the
QUERY_STRING from the parent URL and include the output in my asp file?

Thanks
Ben
 
C

Cowboy \(Gregory A. Beamer\)

You will have to grab the query string and call the perl script. The other
option is to call the perl script directly and have it re-direct to the
page. Which option you choose depends on your unique application needs and
the amount of interaction with the page.
 
B

benwylie

You will have to grab the query string and call the perl script.

Can you give me some pointers on how I can "call the perl script" or
where I can find out how to do that?

On this page:
http://www.codecomments.com/message819530.html
It seems to suggest doing this:
my $returnValues = `perl somescript.pl`;
but that doesn't seem to work for me.

Any pointers as to how I can do what you have said would be helpful.
Thanks
Ben
 
B

Bob Barrows [MVP]

benwylie said:
I am running IIS 6.0 on Windows 2003.

I would like to be able to run a perl script from a web page and
include the output.
I have tried doing it with an ssi:
<form action='docsearch.shtml' method='get'>
<!--#exec cgi="/cgi-bin/docsearch.pl-->
</form>

This correctly ran the script, but it was unable to include the
QUERY_STRING from the parent URL into the included perl script, and
there seems no work around to enable me to do that on IIS 6.0,
therefore on this thread:
http://groups.google.com/group/microsoft.public.inetserver.iis/browse_thread/thread/76ae0d85395a3d72
I was recommended: "to a simple ASP page which will easily do exactly
what you want because it actually has the functionality you want, by
intention, and is supported."
I believe you have misinterpreted this advice. I think David was
suggesting you create an ASP page written with perl to do what you need.
See:

http://msdn.microsoft.com/library/d...html/5f91042d-8ddb-4e0f-a4c6-e1a95b344a60.asp

I've never used perl so I will probably not be able to offer further
assistance.
 
R

Ralf Stolzenberg

Hi Ben!


I had the same problems a few weeks before.
ASP doesn't support most of the SSI commands, AFAIL only the "include"
command.

IU solved my problem using the hints on the article "How do I read the
contents of a remote web page?"
from
http://classicasp.aspfaq.com/general/how-do-i-read-the-contents-of-a-remote-web-page.html .
Eventually you have to install the "MSXML and XML Core Services" described
in the article.

After installation I had only add a few lines like:

<%
url =
"http://<myhosturl>/cgi-bin/counter/Counter.pl?Silent=1&CntName=<myCountername>"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "GET", url, false
xmlhttp.send ""
Response.Write xmlhttp.responseText
set xmlhttp = nothing
%>

to include a perl based counter called from the asp page including the given
GET params.

HTH,

Ralf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top