<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHP Software Developing &#187; dom parse</title>
	<atom:link href="http://www.phpdeveloping.co.za/tag/dom-parse/feed" rel="self" type="application/rss+xml" />
	<link>http://www.phpdeveloping.co.za</link>
	<description>for the love of PHP Development</description>
	<lastBuildDate>Tue, 29 Sep 2009 15:38:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Simple HTML DOM Parser &#8211; Links on a website</title>
		<link>http://www.phpdeveloping.co.za/parsing/simple-html-dom-parser-links-on-a-website.html</link>
		<comments>http://www.phpdeveloping.co.za/parsing/simple-html-dom-parser-links-on-a-website.html#comments</comments>
		<pubDate>Mon, 03 Aug 2009 06:27:42 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Parsing]]></category>
		<category><![CDATA[dom parse]]></category>
		<category><![CDATA[html parsing]]></category>

		<guid isPermaLink="false">http://www.phpdeveloping.co.za/?p=117</guid>
		<description><![CDATA[I&#8217;m always interested in new way to scrape websites, and when I was given a recent project to do I thought it would be the perfect time to test out a class I found recently, Simple HTML POM Parser.  This is what&#8217;s so great about the PHP development community, they share.  
So with [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m always interested in new way to scrape websites, and when I was given a recent project to do I thought it would be the perfect time to test out a class I found recently, <a href="http://simplehtmldom.sourceforge.net/">Simple HTML POM Parser</a>.  This is what&#8217;s so great about the PHP development community, they share.  </p>
<p>So with a few links of code, you are able to parse a complete HTML page and get various information from it.  Here I will look at getting links on a website.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://www.phpdeveloping.co.za/&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$html</span> <span style="color: #339933;">=</span> file_get_html<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$links</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$html</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$links</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$link</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$link</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">href</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$link</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>As simple as that!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpdeveloping.co.za/parsing/simple-html-dom-parser-links-on-a-website.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
