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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Very New at this

Status
Not open for further replies.

Netwrkengeer

IS-IT--Management
Apr 4, 2001
184
US
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 &quot;GET&quot; to a website, also attempts to send info locally to sm2proc.phtml-->
<FONT FACE=&quot;DAXLIGHT&quot; >
<TABLE COLSPEC=&quot;L20 L20&quot; >
<TR>
<TD>
<H1>
</H1>
</TD>
<TD>
Input an address.&nbsp;
<FORM METHOD=get ACTION= <FORM METHOD=post ACTION=sm2proc.phtml>
<input type=hidden name=&quot;dummy&quot; value=&quot;dummy&quot;>
<PRE>
<!--the form variables street,city,state,zip, are unalterable-->
Street Address: <INPUT SIZE=30 NAME=&quot;street&quot;>
City: <INPUT SIZE=30 NAME=&quot;city&quot;>
State: <INPUT SIZE=3 NAME=&quot;state&quot;> Zip: <INPUT SIZE=6 NAME=&quot;zip&quot; <br>

<input type=submit name=&quot;geocode&quot; VALUE=&quot;request&quot;> <SELECT TYPE=&quot;hidden&quot; NAME=&quot;request&quot; SIZE=1> <OPTION SELECTED>Address Info </SELECT>
</PRE>
<input type=hidden name=&quot;cmd&quot; value=&quot;td_g&quot;>
<input type=hidden name=&quot;dum2&quot; value=&quot;dummy&quot;>
</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(&quot;/usr/home/jbh/htdocs/temp&quot;,&quot;sm2&quot;);

/*opening connection to site, utilizing variables to access activated part of site i.e. $street*/
$fp=fopen(&quot; &quot;r&quot;);

/*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 &quot;error&quot;;
}
/*
will use unlink later when adding DB access
@unlink ($tmp)
or die (&quot;can not delete temp&quot;)
*/

/*closing connection*/
fclose($fp);
exit();

?>

/*That is all thanks for any help you can give*/
 
Whats the question? I maybe overlooking it, buti have no idea what ure problem is ;-) mcvdmvs
-- &quot;It never hurts to help&quot; -- Eek the Cat
 
I'm not sure where the problem is, but when I run the code It doesn’t create a temp file, so the information is not getting stored. I don't know if it is the multiple submits, in the html, or if it's the Php code.

Sorry it was late and I was aggravated, I forgot to ask the question, this is my first self-created code.
I didn't copy this from someone, so I'm not even sure if the concepts will work.
Thanks
Robert
 
Dunno, but u are calling two forms. I dont understand what u are doing either, maybe cause im not very bright at the moment, but i see that u are creating a tmp file, which u dont use right away, u are trying then to open a remote file, getting line 103 from the first and the copying some stuff. Maybe someone else can help but maybe u can define ure problem, what u wanna do with this script? (maybe im all wrong and it works with minor adjustments, but i dont see it, sorry) mcvdmvs
-- &quot;It never hurts to help&quot; -- Eek the Cat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top