By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,383 Members | 2,063 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,383 IT Pros & Developers. It's quick & easy.

Running a perl script from an ASP page to include QUERY_STRING

P: n/a
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/micro...ae0d85395a3d72
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

Oct 17 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
"benwylie" <be******@gmail.comwrote in message
news:11*********************@k70g2000cwa.googlegro ups.com...
>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/micro...ae0d85395a3d72
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

Oct 17 '06 #2

P: n/a
On Oct 17, 2:10 pm, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamMwrote:
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

Oct 17 '06 #3

P: n/a
"benwylie" <be******@gmail.comwrote in message
news:11*********************@k70g2000cwa.googlegro ups.com...
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/micro...ae0d85395a3d72
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/de...a95b344a60.asp

I've never used perl so I will probably not be able to offer further
assistance.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Oct 17 '06 #4

P: n/a
Hi Ben!

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomschrieb im Newsbeitrag
news:Oq**************@TK2MSFTNGP02.phx.gbl...
>"benwylie" <be******@gmail.comwrote in message
news:11*********************@k70g2000cwa.googlegr oups.com...
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:
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...-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

Oct 19 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.