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

debug file parsing

Status
Not open for further replies.

gagz

Programmer
Nov 21, 2002
333
US
Hi...

can someone tell me while the code below won't correctly parse a delimited file set up like:

Code:
<url>
[URL unfurl="true"]http://www.test.com[/URL]
</url>
<blurb>
This is some text.

More text.
</blurb>

Code:
if (ereg(&quot;(link)\$&quot;,$_POST[&quot;files&quot;]))
      {
        while ( ! feof( $newsfile ) )
        {
            $line = fgets( $newsfile, 1024 );
	    if ($line == &quot;<url>&quot;)
	    {
	        $line = fgets( $newsfile, 1024);
                $url_val = $line;
	    }
	    if ($line == &quot;<blurb>&quot;)
	    {
	      while ( $line != &quot;</blurb>&quot;)
	      {
                $blurb_val = $blurb_val . $line;
                $line = fgets( $newsfile, 1024 );
	      }
	    }
	}
 }

thanks!
 
btw, the file name is .link, thats why the if statement is there... and the filehande $newsfile is correctly opened already, just didn't post the code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top