<?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>My Scribbles &#187; php programming</title>
	<atom:link href="http://www.blazecoder.com/category/php-programming/feed" rel="self" type="application/rss+xml" />
	<link>http://www.blazecoder.com</link>
	<description></description>
	<lastBuildDate>Thu, 08 Jul 2010 05:15:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>HTML Table Border Not Working On Wordpress.</title>
		<link>http://www.blazecoder.com/php-programming/html-table-border-not-working-on-wordpress</link>
		<comments>http://www.blazecoder.com/php-programming/html-table-border-not-working-on-wordpress#comments</comments>
		<pubDate>Sat, 10 Apr 2010 08:50:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SEO Tips]]></category>
		<category><![CDATA[php programming]]></category>
		<category><![CDATA[HTML Table Border Not Working On Wordpress]]></category>
		<category><![CDATA[table borders in wordpress]]></category>

		<guid isPermaLink="false">http://www.blazecoder.com/?p=373</guid>
		<description><![CDATA[Creating html tables is pretty simple. It might be on Wordpress or any CMS Website. But Yesterday, I was left hanging for an hour finding solutions about my wordpress table borders not showing. This problem seems pretty familiar to those CSS/HTML Geeks and hard coder programmers  but I&#8217;m posting it here so It can help [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Creating html tables is pretty simple. It might be on Wordpress or any CMS Website. But Yesterday, I was left hanging for an hour finding solutions about my wordpress table borders not showing. This problem seems pretty familiar to those CSS/HTML Geeks and hard coder programmers  but I&#8217;m posting it here so It can help others facing the same problems as mine.</p>
<p>It seems that the problem is related to the Wordpress Themes I&#8217;ve used which is iThemes. Considering that in other Wordpress themes, they have CSS styling that overrides your code onpage and that table borders are not visible.</p>
<p style="text-align: justify;">This codes solves my problem about html table borders not showing on wordpress. Hope it help yours as well.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>table style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;border:solid 1px #000033; &quot;</span> border<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span> cellspacing<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;0&quot;</span> cellpadding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;2&quot;</span> width<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;600&quot;</span> align<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;center&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>tbody<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>td style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;border:solid 2px #ffffff;padding-right:.5em;&quot;</span> valign<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;middle&quot;</span><span style="color: #339933;">&gt;</span>Bronze<span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>td style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;padding-left:.5em;&quot;</span> align<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;center&quot;</span> valign<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;middle&quot;</span><span style="color: #339933;">&gt;</span>Silver<span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>tr<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>tbody<span style="color: #339933;">&gt;&lt;/</span>table<span style="color: #339933;">&gt;</span></pre></div></div>

<p><script type="text/javascript"><!--
google_ad_client = "pub-1981373199781806";
/* Rectangle Banner 336x280, created 6/16/10 */
google_ad_slot = "9279138769";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blazecoder.com/php-programming/html-table-border-not-working-on-wordpress/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Using cURL with PHP</title>
		<link>http://www.blazecoder.com/php-programming/using-curl-with-php</link>
		<comments>http://www.blazecoder.com/php-programming/using-curl-with-php#comments</comments>
		<pubDate>Fri, 16 Oct 2009 23:42:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php programming]]></category>
		<category><![CDATA[curl syntax in php]]></category>
		<category><![CDATA[domdocument loadxml]]></category>
		<category><![CDATA[How to use curl in php]]></category>
		<category><![CDATA[php curl example]]></category>
		<category><![CDATA[php curl tutorial]]></category>
		<category><![CDATA[php domdocument]]></category>
		<category><![CDATA[php domdocument loadxml syntax]]></category>
		<category><![CDATA[xml domdocument]]></category>

		<guid isPermaLink="false">http://localhost/suarezbevs/?p=10</guid>
		<description><![CDATA[Today,  I&#8217;ll give you some hint about how to use cURL in PHP.
cURL is a library that allow a webserver to transfer files with a remote computer using a variety of Internet protocols. cURL stands for &#8220;Client URLs&#8221;, it is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, [...]]]></description>
			<content:encoded><![CDATA[<p>Today,  I&#8217;ll give you some hint about how to use cURL in PHP.</p>
<p>cURL is a library that allow a webserver to transfer files with a remote computer using a variety of Internet protocols. cURL stands for &#8220;Client URLs&#8221;, it is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, HTTP, HTTPS,GOPHER, LDAP, DICT, TELNET and FILE.</p>
<p>Once you&#8217;ve compiled PHP with cURL support, you can begin using the cURL functions.</p>
<p>The basic idea behind the cURL functions is that you initialize a cURL session using the curl_init(),  then you can set all your options for the transfer via the curl_setopt(), then you can execute the session with the curl_exec() and then you finish off your session using the curl_close().</p>
<p>Using cURL from the command line is easy.  Here is an example that uses PHP cURL functions to fetch the data from <a href="http://www.poweropt.com/optionable.asp?fl=A">PowerOptions</a> Website  and prints it&#8217;s output. The data that I&#8217;m going to harvest would be the Company Name and Symbol.</p>
<p>Here is the function  I&#8217;ve used:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> scrape<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_USERAGENT<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.10) Gecko/2009042523 Ubuntu/9.04 (jaunty) Firefox/3.0.10&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_FAILONERROR<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_FOLLOWLOCATION<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_AUTOREFERER<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_CONNECTTIMEOUT<span style="color: #339933;">,</span> <span style="color: #cc66cc;">60</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_VERBOSE<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;http://www.poweropt.com/optionable.asp?fl=A&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_TIMEOUT<span style="color: #339933;">,</span> <span style="color: #cc66cc;">120</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_PROXY<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;192.168.20.206:3128&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$html</span><span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</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: #339933;">!</span><span style="color: #000088;">$html</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;cURL error number:&quot;</span> <span style="color: #339933;">.</span><span style="color: #990000;">curl_errno</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<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: #0000ff;">&quot;cURL error:&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">curl_error</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$dom</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DOMDocument<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">@</span><span style="color: #000088;">$dom</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>loadHTML<span style="color: #009900;">&#40;</span><span style="color: #000088;">$html</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$xpath</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DOMXPath<span style="color: #009900;">&#40;</span><span style="color: #000088;">$dom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$nodeLists</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$xpath</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>evaluate<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;//*[contains(text(), 'Company Name')]/ancestor::table[1]//tr&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #000088;">$nodeLists</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>length<span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$node</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$nodeLists</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>item<span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$node</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$node</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>firstChild<span style="color: #339933;">;</span>
	<span style="color: #000088;">$tempNode</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$node</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>firstChild<span style="color: #339933;">;</span>
	<span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tempNode</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>nodeValue<span style="color: #339933;">;</span>
	<span style="color: #000088;">$node</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$node</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>nextSibling<span style="color: #339933;">;</span>
	<span style="color: #000088;">$node</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$node</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>nextSibling<span style="color: #339933;">;</span>
	<span style="color: #000088;">$symbol</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$node</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>nodeValue<span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">//echo $name.&quot; | &quot;. $symbol .&quot;&quot;;</span>
	<span style="color: #666666; font-style: italic;">//echo &quot;&lt;span style=&quot;font-family: Tahoma; color: black;&quot;&gt;&quot;.$name. &quot;|&quot;. $symbol .&quot;&lt;/span&gt;&quot;;</span>
	<span style="color: #666666; font-style: italic;">//Saving the data autpmaticaly after scraping.</span>
	<span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO company (company_name, symbol) VALUES('<span style="color: #006699; font-weight: bold;">$name</span>','<span style="color: #006699; font-weight: bold;">$symbol</span>')&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In the above example,<strong> curl_exec($ch)</strong> execute the returned data from the remote server and stored in the variable $html.</p>
<p>For more advance technique,  I used  <strong>PHP DOMDocument() Class</strong> for extracting the harvested data instead of using php <strong>preg_match_all</strong> function.</p>
<p>Source:  <a href="http://www.php.net/manual/en/curl.examples-basic.php">php.net</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blazecoder.com/php-programming/using-curl-with-php/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
