Re: Multiple targets with fscanf
| From: | Denis 'Alpheus' Cahuk | Date: | Fri, 01 Aug 2003 16:46:42 +0000 |
| Subject: | Re: Multiple targets with fscanf | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157981@lists.php.net to get a copy of this message | ||
Dan Anderson wrote:
Is there any reason you couldn't do something like: <?php $buffer = implode("\n",file($somesite)); while (strstr($buffer,"<li>"); { $li_tag_start_position = strpos($buffer,"<li>"); $li_tag_end_position = strpos($buffer,"</li>"); $data = substr($buffer,(4 + $li_tag_start_position),(4 + $li_tag_end_position)); $buffer = substr($buffer, (4 + $li_tag_end_position)); } ?> Note that you could significantly compact the code by putting the strpos calls in substr. This would, however, obfusicate it. -Dan On Fri, 2003-08-01 at 07:15, Denis 'Alpheus' Cahuk wrote:Thanks again. You were a great help. If you want to help more on building this website, contact me please. Denis 'Alpheus' CahukHello! I'll get strait to the point: I want to include a header from another site ($fp = fopen("www.something.info/news.html", "r")) using the fscanf command, The headers are in "<li>..." tags and I'm usign $a = fscanf($fp, "<li>%s"). the problem is, that if I use this, I get only the first word in the header, but I would like to get the whole line until the next <li>. Thanks in advance Denis 'Alpheus' CahukThanks a lot. I managed to get the data. I just have to filter it out now with my own filter system for arrays and strings :D