Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

perl > asp script help 1

Status
Not open for further replies.

blitzer

Programmer
Jun 18, 2001
34
0
0
CA
I am new to asp, but i dont think i need to know alot to do this. i have made a perl script which just reads the output of a page (selected according to the parameters) and prints it. Here is the entire script:

[blue]
#!/usr/bin/perl

### ### ###

use LWP::Simple;
$the_uri = $ENV{'HTTP_HOST'};
use CGI qw :)standard);
use CGI::Carp qw(fatalsToBrowser);

$q = new CGI;

$openfile = $q->param(openfile);
$id_it = $q->param(id);
$a_area = $q->param(a_area);
$b_area = $q->param(b_area);
@keys = $q->param(key);
$key_matches = @keys;

## find index pages and choose according to the uri ##
unless ($openfile) { $openfile = "services"; }

$URL = "my $content = get($URL);

$content = "\n$content";
($key,@content2) = split(/\n/, $content);

print "Content-type: text/html\n\n";
foreach $content2 (@content2) {
print "$content2\n";
}
[/blue]

As you can see this is very simple. If i could do just this script in asp then i could offer my entire program in asp without actually converting it. I would like to do the same with PHP.

I have no idea where to start, so any help would be appreciated.

Much thanks,
B
 
What ASP language will you be using? You have the standard choices of VBScript and JScript (Javascript), and others (including Perlscript) if your web host has them installed on the server.

Lee
 
hi Lee, which language would you recommend? im pretty sure we have all of them installed but i own the server so we could install them ourself if need be.

thanks
 
ASP version
Code:
<%
'you need to figureout 
set xml=Server.CreateObject("Microsoft.XMLHTTP")
openfile=Request("openfile")
a=Request("a")
b=Request("b")
'add more here
url="[URL unfurl="true"]http://www.myurl.com/cgi-bin/"[/URL] & openfile & "?a=" &a& "&b=" &b
xml.open "GET", url,true
response.Write xml.ResponseText
%>

PHP version
Code:
<?
$openfile=$_REQUEST["openfile"];
$a=$_REQUEST["a"];
$b=$_REQUEST["b"];
//add more here
$url="[URL unfurl="true"]http://www.myurl.com/cgi-bin/$openfile?a=$a&b=$b";[/URL]
$data=file($url);
echo $data;
?>

You need to figur out what's the General XmlHttp object name, usualy looks like that.


________
George, M
Searches(faq333-4906),Carts(faq333-4911)
 
Thanks George,

When i load the php version all i get is "Array" and a white blank page. Also, should my server know what the General XmlHttp object name is?

B
 
Ah sorry forgot that file() returns an array of strings
use
Code:
$data=join("\n",file($url));

________
George, M
Searches(faq333-4906),Carts(faq333-4911)
 
XmlHttp should exists in any windows XP/2000/2003 versions but probably with diferent versions but all will have those methods, you only need to find the proper name for it.

________
George, M
Searches(faq333-4906),Carts(faq333-4911)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top