[Sussex] [OT kinda] PHP and regex (almost solved! Gareth can help on this one!) ;o)

Gareth Ablett garethablett at phpw.fsnet.co.uk
Tue Nov 26 16:09:04 UTC 2002


hi matt,

I had a play around and came up with this.

<?php

$filename = 'retrieve.htm';

$fp = fopen( $filename, "r" ) or die( "Error opening File - $filename" );
while ( ! feof( $fp ))
	  {
	  $line = fgets( $fp, 1024 );
	  if ( eregi( '<a * href="[^"]*[^"]*"*>*[A-Z0-9 ]+</a>', $line, $quote ))
	  	 {
		 $body .= $quote[0]."<br />";
		 }
	  }

fclose( $fp );

echo $body;

?>

I did notice taht this works for you link page but it doesnt want to output
more
then one link per line. and I cant figure this out. note there other was of
doing
this that will work for all links.

but noticed that the eregi string had problems with ppl had wiered link code
I changed it a little to help this though.

Gareth Ablett


=================================================================

The above information is confidential to the addressee and may be
privileged.  Unauthorised access and use is prohibited.

Internet communications are not secure and therefore this Body
does not accept legal responsibility for the contents of this
message.

If you are not the intended recipient, any disclosure, copying,
distribution or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. unlawful.

-----Original Message-----
From: sussex-admin at mailman.lug.org.uk
[mailto:sussex-admin at mailman.lug.org.uk]On Behalf Of Macdonald-Wallace,
Matthew J
Sent: 26 November 2002 10:52 am
To: 'sussex at mailman.lug.org.uk'
Subject: RE: [Sussex] [OT kinda] PHP and regex (almost solved! Gareth
can help on this one!) ;o)


Check out www.interactwiththe.net/retrieve/

it's linking to a page in the same dir - retrieve.html - that has 5 links in
it...

Matt

>-----Original Message-----
>From: Gareth Ablett [mailto:garethablett at phpw.fsnet.co.uk]
>Sent: 25 November 2002 22:05
>To: sussex at mailman.lug.org.uk
>Subject: RE: [Sussex] [OT kinda] PHP and regex (almost solved! Gareth
>can help on this one!) ;o)
>
>
>what is outputting atm?
>
>
>Gareth,
>
>Can you help with why the loop isn't working?
>
>My eyes must be shot to blazes tonight!
>
>$pattern= '<a href="[^"]*[^"]*">*[A-Z0-9 ]+</a>';
>
>if(eregi($pattern, $contents, $quote))
>{
>$number=count($quote);
>echo $number."<br />";
>for($i=0; $i <= $number; $i++)
>	{
>	$body .= $quote[$i]."\n";
>	}
>}
>else
>{
>	echo "no quote available";
>}
>fclose($fp);
>mail("fruitloop at cowsontour.com","Test",$body);
>
>TIA,
>
>Matt
>
>>-----Original Message-----
>>From: Gareth Ablett [mailto:garethablett at phpw.fsnet.co.uk]
>>Sent: 25 November 2002 20:04
>>To: sussex at mailman.lug.org.uk
>>Subject: RE: [Sussex] [OT kinda] PHP and regex
>>
>>
>>:(
>>
>>for once a question I can help with and some one beets me to it.
>>oh well maby next time.
>>
>>Gareth Ablett
>>
>>
>>=================================================================
>>
>>The above information is confidential to the addressee and may be
>>privileged.  Unauthorised access and use is prohibited.
>>
>>Internet communications are not secure and therefore this Body
>>does not accept legal responsibility for the contents of this
>>message.
>>
>>If you are not the intended recipient, any disclosure, copying,
>>distribution or any action taken or omitted to be taken in
>>reliance on it, is prohibited and may be unlawful. unlawful.
>>
>>_______________________________________________
>>Sussex mailing list
>>Sussex at mailman.lug.org.uk
>>http://mailman.lug.org.uk/mailman/listinfo/sussex
>>
>
>_______________________________________________
>Sussex mailing list
>Sussex at mailman.lug.org.uk
>http://mailman.lug.org.uk/mailman/listinfo/sussex
>
>
>_______________________________________________
>Sussex mailing list
>Sussex at mailman.lug.org.uk
>http://mailman.lug.org.uk/mailman/listinfo/sussex
>

_______________________________________________
Sussex mailing list
Sussex at mailman.lug.org.uk
http://mailman.lug.org.uk/mailman/listinfo/sussex





More information about the Sussex mailing list