[PHP] HTML parser (maybe even HTML to BBCode)

2007-12-20 Thread Arvids Godjuks
Hi!
I'm looking for fast HTML parser, witch can give me a tree of tags with
their attributes.
Maybe some one know a good HTML to BBCode parser, because that's exactly
what i need. tried looking Google, doesn't helped much, still need to make a
HTML to BBCode parser myself.


Re: [PHP] HTML parser (maybe even HTML to BBCode)

2007-12-20 Thread Daniel Brown
On Dec 20, 2007 10:30 AM, Arvids Godjuks [EMAIL PROTECTED] wrote:
 Hi!
 I'm looking for fast HTML parser, witch can give me a tree of tags with
 their attributes.
 Maybe some one know a good HTML to BBCode parser, because that's exactly
 what i need. tried looking Google, doesn't helped much, still need to make a
 HTML to BBCode parser myself.


I'm not sure if the PECL BBCode module will help you or not (I'm
not sure if it reverses the code), but it may.

http://pecl.php.net/package/bbcode

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HTML parser (maybe even HTML to BBCode)

2007-12-20 Thread Arvids Godjuks
I saw it, it only converts BBCode to HTML.
BBCode to HTML isn't a problem - a child can do that with str_replace and a
little help of preg_replace for links and images. The trick is that i need a
HTML to BBCode parser.


2007/12/20, Daniel Brown [EMAIL PROTECTED]:

 On Dec 20, 2007 10:30 AM, Arvids Godjuks [EMAIL PROTECTED] wrote:
  Hi!
  I'm looking for fast HTML parser, witch can give me a tree of tags with
  their attributes.
  Maybe some one know a good HTML to BBCode parser, because that's exactly
  what i need. tried looking Google, doesn't helped much, still need to
 make a
  HTML to BBCode parser myself.
 

I'm not sure if the PECL BBCode module will help you or not (I'm
 not sure if it reverses the code), but it may.

http://pecl.php.net/package/bbcode

 --
 Daniel P. Brown
 [Phone Numbers Go Here!]
 [They're Hidden From View!]

 If at first you don't succeed, stick to what you know best so that you
 can make enough money to pay someone else to do it for you.



Re: [PHP] HTML parser (maybe even HTML to BBCode)

2007-12-20 Thread Richard Lynch
On Thu, December 20, 2007 9:30 am, Arvids Godjuks wrote:
 Hi!
 I'm looking for fast HTML parser, witch can give me a tree of tags
 with
 their attributes.
 Maybe some one know a good HTML to BBCode parser, because that's
 exactly
 what i need. tried looking Google, doesn't helped much, still need to
 make a
 HTML to BBCode parser myself.


http://php.net/dom
will give you the tree.

You are on your own trying to convert to BBCode.


-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] html parser tutorial

2004-12-07 Thread Ahmed Abdel-Aliem
Doesn anyone plz knows a good tutorial for parsing html files ?
i have a html page and i want to parse information from it to insert
it into mysql.
i have a good experience in php, but i didn't write a parser before.
can anyone help plz ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] html parser tutorial

2004-12-07 Thread rouvas
On Tuesday 07 December 2004 19:09, Ahmed Abdel-Aliem wrote:
 Doesn anyone plz knows a good tutorial for parsing html files ?
 i have a html page and i want to parse information from it to insert
 it into mysql.

Check out:
http://0x00.org/php/phpHTMLparse/index.php

-Stathis

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] html parser tutorial

2004-12-07 Thread Richard Lynch
Ahmed Abdel-Aliem wrote:
 Doesn anyone plz knows a good tutorial for parsing html files ?
 i have a html page and i want to parse information from it to insert
 it into mysql.
 i have a good experience in php, but i didn't write a parser before.
 can anyone help plz ?

TidyHTML is supposed to be good at that.  Never actually tried it, but
John Coggeshall's presentation a few months ago at the Chicago PHP User
Group meeting was pretty compelling.

If you only need a few small bits of information from web pages whose
format doesn't change often, you can maybe get it done really fast and
easy with http://php.net/explode.

I've scraped a lot of stuff that way myself.

You simply have to search the HTML for a distinctive tag that is unlikely
to change often and is shortly before the content you want.

Then use http://php.net/explode with that tag.  For example, on a site
with calendar events, you might use:

?php
  $file = file('http://example.com/');
  $html = implode('', $file);
  $parts = explode('td class=event_date', $html);
  while (list(, $event) = each($parts)){
list($date, $speaker, $description) = explode('/td', $event);
//Prepend td because we stripped it off in 'explode' 3 lines above
$date = strip_tags(td $date);
$speaker = strip_tags($speaker);
$description = strip_tags($description);
//Double-check the data as a valid date,
//maybe even speaker/description as non-empty
//and either log error or insert to your database
  }
?

MOST sites with content you want to scrape on a routine basis are pretty
predictable.  CSS classes can be particularly useful to find the right
bits you want to scrap.

Occasionally I run across one where it's hand-edited and completely
unpredictable -- and usually not worth scraping, in my experience.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] html parser

2002-08-12 Thread Curtis A. Weyant

Does anyone know of a good PHP HTML parser out there that I can use?

Thanks,
Curtis.


Is your boss reading your email? Probably
Keep your messages private by using Lycos Mail.
Sign up today at http://mail.lycos.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] html parser

2002-08-12 Thread Justin French

I was looking for one for AGES.

There are a few bits on phpclasses.org, but they didn't suit MY needs.

I actually decided to start writing my own, because I only needed to parse a
VERY limited subset of HTML (just a few different tags).

Justin French


on 13/08/02 2:35 AM, Curtis A. Weyant ([EMAIL PROTECTED]) wrote:

 Does anyone know of a good PHP HTML parser out there that I can use?
 
 Thanks,
 Curtis.
 
 
 Is your boss reading your email? Probably
 Keep your messages private by using Lycos Mail.
 Sign up today at http://mail.lycos.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php