Netwrkengeer
IS-IT--Management
Ok I wrote some code and have know Idea what I'm doing, but I commented it alot.
just a quick run down, I have an html file parsing a website and a local php file. here they are html first
/*HTML, file name is eagle.htm*/
<html><head><title>SM2</title></head><body>
<!--the form attempts to send info via "GET" to a website, also attempts to send info locally to sm2proc.phtml-->
<FONT FACE="DAXLIGHT" >
<TABLE COLSPEC="L20 L20" >
<TR>
<TD>
<H1>
</H1>
</TD>
<TD>
Input an address.
<FORM METHOD=get ACTION= <FORM METHOD=post ACTION=sm2proc.phtml>
<input type=hidden name="dummy" value="dummy">
<PRE>
<!--the form variables street,city,state,zip, are unalterable-->
Street Address: <INPUT SIZE=30 NAME="street">
City: <INPUT SIZE=30 NAME="city">
State: <INPUT SIZE=3 NAME="state"> Zip: <INPUT SIZE=6 NAME="zip" <br>
<input type=submit name="geocode" VALUE="request"> <SELECT TYPE="hidden" NAME="request" SIZE=1> <OPTION SELECTED>Address Info </SELECT>
</PRE>
<input type=hidden name="cmd" value="td_g">
<input type=hidden name="dum2" value="dummy">
</FORM>
</TD>
</TR>
</TABLE>
</body></html>
/*PHP, file name is sm2proc.phtml*/
<?php
/*
overview of code.
To submit info to a website via GET, then find line 103
take the text from line 103 and place it in a temp file, which will later be placed in a database
but for now will be copied to a text file.
*/
/*creating temp file*/
$tmp=tempnam("/usr/home/jbh/htdocs/temp","sm2"
/*opening connection to site, utilizing variables to access activated part of site i.e. $street*/
$fp=fopen(" "r"
/*looping through html of site to find line 103 to grab next*/
$line_s=0;
while ($line_s=fgets($fp,103)) {
if ($line_s==$line_num) {
$right_line=$line;
break;
}
$line_s++;
}
/*copy $fp info to $tmp*/
if (copy ($fp,$tmp)){
echo $tmp;
}else{
echo $fp;
print "error";
}
/*
will use unlink later when adding DB access
@unlink ($tmp)
or die ("can not delete temp"
*/
/*closing connection*/
fclose($fp);
exit();
?>
/*That is all thanks for any help you can give*/
just a quick run down, I have an html file parsing a website and a local php file. here they are html first
/*HTML, file name is eagle.htm*/
<html><head><title>SM2</title></head><body>
<!--the form attempts to send info via "GET" to a website, also attempts to send info locally to sm2proc.phtml-->
<FONT FACE="DAXLIGHT" >
<TABLE COLSPEC="L20 L20" >
<TR>
<TD>
<H1>
</H1>
</TD>
<TD>
Input an address.
<FORM METHOD=get ACTION= <FORM METHOD=post ACTION=sm2proc.phtml>
<input type=hidden name="dummy" value="dummy">
<PRE>
<!--the form variables street,city,state,zip, are unalterable-->
Street Address: <INPUT SIZE=30 NAME="street">
City: <INPUT SIZE=30 NAME="city">
State: <INPUT SIZE=3 NAME="state"> Zip: <INPUT SIZE=6 NAME="zip" <br>
<input type=submit name="geocode" VALUE="request"> <SELECT TYPE="hidden" NAME="request" SIZE=1> <OPTION SELECTED>Address Info </SELECT>
</PRE>
<input type=hidden name="cmd" value="td_g">
<input type=hidden name="dum2" value="dummy">
</FORM>
</TD>
</TR>
</TABLE>
</body></html>
/*PHP, file name is sm2proc.phtml*/
<?php
/*
overview of code.
To submit info to a website via GET, then find line 103
take the text from line 103 and place it in a temp file, which will later be placed in a database
but for now will be copied to a text file.
*/
/*creating temp file*/
$tmp=tempnam("/usr/home/jbh/htdocs/temp","sm2"
/*opening connection to site, utilizing variables to access activated part of site i.e. $street*/
$fp=fopen(" "r"
/*looping through html of site to find line 103 to grab next*/
$line_s=0;
while ($line_s=fgets($fp,103)) {
if ($line_s==$line_num) {
$right_line=$line;
break;
}
$line_s++;
}
/*copy $fp info to $tmp*/
if (copy ($fp,$tmp)){
echo $tmp;
}else{
echo $fp;
print "error";
}
/*
will use unlink later when adding DB access
@unlink ($tmp)
or die ("can not delete temp"
*/
/*closing connection*/
fclose($fp);
exit();
?>
/*That is all thanks for any help you can give*/