You are here: Re: reading an html page. « PHP Programming Language « IT news, forums, messages
Re: reading an html page.

Posted by Jerry Stuckle on 03/14/06 06:17

Mladen Gogala wrote:
> On Mon, 13 Mar 2006 16:00:45 +0100, VooDoo wrote:
>
>
>>Hi,
>>I have a database that have all my dell desktop with the dell serial number.
>>I would like to update my database with the ship date from this url:
>>http://support.euro.dell.com/support/topics/topic.aspx/emea/shared/support/my_systems_info/fr/details?c=en&cs=frbsdt1&l=fr&s=bsd&ServiceTag=1DTDD0J
>>
>>How can i easily get only the date from all this html page??
>>Thanks for your ideas.
>>VooDoo
>
>
> #!/usr/local/bin/php
> <?php
> $url = 'http://tinyurl.com/qfehg';
> $match = array();
> $FILE = fopen($url, 'r');
> while ($line = fread($FILE, 1024)) {
> if (preg_match('/ship date:.*(\d{2}\/\d{2}\/\d{4})/i', $line, $match)) {
> echo "Ship date is:", $match[1], "\n";
> fclose($FILE);
> break;
> }
> }
> ?>
>
>
> Ship date is extracted. How are you going to update database and
> what database are you talking about is another matter indeed. This
> was a really simple programming exercise.
>
>

And this will fail if the ship date spans a 1024 byte block.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация