<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.1" -->
<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/"
	>

<channel>
	<title>BRADINO</title>
	<link>http://www.bradino.com</link>
	<description>LAMP Development Tutorials, Code, Tips &#38; Tricks</description>
	<pubDate>Tue, 10 Jun 2008 17:26:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
	<language>en</language>
			<item>
		<title>Dayparting on Datetime Field using Substring</title>
		<link>http://www.bradino.com/mysql/dayparting-on-datetime-field-using-substring/</link>
		<comments>http://www.bradino.com/mysql/dayparting-on-datetime-field-using-substring/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 17:26:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.bradino.com/mysql/dayparting-on-datetime-field-using-substring/</guid>
		<description><![CDATA[Today I needed a quick and easy way to count the number of records for each of the 24 hours in a day for records in a mysql database that has a datetime field. I came up with the following query to solve that problem:


SELECT count&#40; SUBSTRING&#40; `datetime` , 12, 2 &#41; &#41; AS `num` [...]]]></description>
			<content:encoded><![CDATA[<p>Today I needed a quick and easy way to count the number of records for each of the 24 hours in a day for records in a mysql database that has a datetime field. I came up with the following query to solve that problem:</p>
<div class="syntax_hilite">
<div id="sql-2">
<div class="sql"><span style="color: #993333; font-weight: bold;">SELECT</span> count<span style="color:#006600; font-weight:bold;">&#40;</span> SUBSTRING<span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color: #ff0000;">`datetime`</span> , <span style="color: #cc66cc;">12</span>, <span style="color: #cc66cc;">2</span> <span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">`num`</span> , SUBSTRING<span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color: #ff0000;">`datetime`</span> , <span style="color: #cc66cc;">12</span>, <span style="color: #cc66cc;">2</span> <span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #ff0000;">`hour`</span><br />
<span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #ff0000;">`table`</span><br />
<span style="color: #993333; font-weight: bold;">GROUP</span> <span style="color: #993333; font-weight: bold;">BY</span> SUBSTRING<span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color: #ff0000;">`datetime`</span> , <span style="color: #cc66cc;">12</span>, <span style="color: #cc66cc;">2</span> <span style="color:#006600; font-weight:bold;">&#41;</span><br />
<span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">`num`</span> <span style="color: #993333; font-weight: bold;">DESC</span></div>
</div>
</div>
<p></p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/mysql/" rel="tag">mysql</a> <a href="http://www.bradino.com/search/dayparting/" rel="tag">dayparting</a> <a href="http://www.bradino.com/search/substring/" rel="tag">substring</a> <a href="http://www.bradino.com/search/hour counts/" rel="tag">hour counts</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/mysql/dayparting-on-datetime-field-using-substring/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP Screen Scraping</title>
		<link>http://www.bradino.com/php/php-screen-scraping/</link>
		<comments>http://www.bradino.com/php/php-screen-scraping/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 18:20:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.bradino.com/php/php-screen-scraping/</guid>
		<description><![CDATA[I had a request recently for help with scraping a little content from http://www.newyork411.com :)
So here we go. This time I made a quick PHP class with some basic functions to grab the source fo the page as well as fetchBetween, fetchAfter, fetchAll, etc. You can get the latest version of the class at http://www.bradino.com/downloads/cScrape.txt [...]]]></description>
			<content:encoded><![CDATA[<p>I had a request recently for help with scraping a little content from http://www.newyork411.com :)</p>
<p>So here we go. This time I made a quick PHP class with some basic functions to grab the source fo the page as well as fetchBetween, fetchAfter, fetchAll, etc. You can get the latest version of the class at http://www.bradino.com/downloads/cScrape.txt - be sure to rename it to cScrape.php. If there is an interest I can continue to develop this class a tool for screens craping with PHP.</p>
<p>Anyway so here we go scraping all the companies from this page http://www.newyork411.com/Ad_Agencies_Production_Companies/category-cid-50553.htm as well as the details of each company, found by clicking on the company.</p>
<p><strong>Step 1 - Initialize the class and fetch the page:</strong></p>
<div class="syntax_hilite">
<div id="php-6">
<div class="php"><span style="color:#616100;">include</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'cScrape.php'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p><span style="color:#0000FF;">$scrape</span> = <span style="color:#000000; font-weight:bold;">new</span> Scrape<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p><span style="color:#0000FF;">$url</span> = <span style="color:#FF0000;">'http://www.newyork411.com/Ad_Agencies_Production_Companies/category-cid-50553.htm'</span>;</p>
<p><span style="color:#0000FF;">$scrape</span>-&gt;<span style="color:#006600;">fetch</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$url</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p><span style="color:#0000FF;">$data</span> = <span style="color:#0000FF;">$scrape</span>-&gt;<span style="color:#006600;">removeNewlines</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$scrape</span>-&gt;<span style="color:#006600;">result</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p><strong>Step 2 - find your anchor and get the chunk of html that contains what you want</strong></p>
<div class="syntax_hilite">
<div id="php-7">
<div class="php"><span style="color:#0000FF;">$data</span> = <span style="color:#0000FF;">$scrape</span>-&gt;<span style="color:#006600;">fetchBetween</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'&lt;table width=&quot;490&quot; border=&quot;0&quot; cellpadding=&quot;3&quot;'</span>,<span style="color:#FF0000;">'&lt;/table&gt;'</span>,<span style="color:#0000FF;">$data</span>,<span style="color:#000000; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p><span style="color:#0000FF;">$rows</span> = <span style="color:#0000FF;">$scrape</span>-&gt;<span style="color:#006600;">fetchAllBetween</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'&lt;TR'</span>,<span style="color:#FF0000;">'&lt;/tr&gt;'</span>,<span style="color:#0000FF;">$data</span>,<span style="color:#000000; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p><strong>Step 3 - parse out the individual values and print out the first record for demo</strong></p>
<div class="syntax_hilite">
<div id="php-8">
<div class="php"><span style="color:#616100;">foreach</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$rows</span> <span style="color:#616100;">as</span> <span style="color:#0000FF;">$id</span> =&gt; <span style="color:#0000FF;">$row</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#0000FF;">$record</span> = <a href="http://www.bradino.com/php-functions/array/"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#0000FF;">$cells</span> = <span style="color:#0000FF;">$scrape</span>-&gt;<span style="color:#006600;">fetchAllBetween</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'&lt;td'</span>,<span style="color:#FF0000;">'&lt;/td&gt;'</span>,<span style="color:#0000FF;">$row</span>,<span style="color:#000000; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#0000FF;">$record</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'company'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <a href="http://www.bradino.com/php-functions/strip_tags/"><span style="color:#000066;">strip_tags</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$cells</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#0000FF;">$url</span> = <span style="color:#FF0000;">'http://www.newyork411.com'</span> . <span style="color:#0000FF;">$scrape</span>-&gt;<span style="color:#006600;">fetchBetween</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'&lt;a href=&quot;'</span>,<span style="color:#FF0000;">'&quot;&gt;'</span>,<span style="color:#0000FF;">$cells</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span>,<span style="color:#000000; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#0000FF;">$url</span> = <a href="http://www.bradino.com/php-functions/str_replace/"><span style="color:#000066;">str_replace</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">' '</span>,<span style="color:#FF0000;">'%20'</span>,<span style="color:#0000FF;">$url</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#0000FF;">$scrape</span>-&gt;<span style="color:#006600;">fetch</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$url</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#0000FF;">$data2</span> = <span style="color:#0000FF;">$scrape</span>-&gt;<span style="color:#006600;">removeNewlines</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$scrape</span>-&gt;<span style="color:#006600;">result</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#0000FF;">$data2</span> = <span style="color:#0000FF;">$scrape</span>-&gt;<span style="color:#006600;">fetchBetween</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'&lt;div id=&quot;tabText&quot;&gt;'</span>,<span style="color:#FF0000;">'&lt;/div&gt;'</span>,<span style="color:#0000FF;">$data2</span>,<span style="color:#000000; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#0000FF;">$data2</span> = <span style="color:#0000FF;">$scrape</span>-&gt;<span style="color:#006600;">fetchAfter</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'&lt;/table&gt;'</span>,<span style="color:#0000FF;">$data2</span>,<span style="color:#000000; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span style="color:#0000FF;">$details</span> = <a href="http://www.bradino.com/php-functions/explode/"><span style="color:#000066;">explode</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'&lt;br /&gt;'</span>,<span style="color:#0000FF;">$data2</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#0000FF;">$record</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'address'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0000FF;">$details</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#0000FF;">$location</span> = <a href="http://www.bradino.com/php-functions/explode/"><span style="color:#000066;">explode</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">','</span>,<span style="color:#0000FF;">$details</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#0000FF;">$record</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'city'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <a href="http://www.bradino.com/php-functions/trim/"><span style="color:#000066;">trim</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$location</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#0000FF;">$location</span> = <a href="http://www.bradino.com/php-functions/explode/"><span style="color:#000066;">explode</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">' '</span>,<a href="http://www.bradino.com/php-functions/trim/"><span style="color:#000066;">trim</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$location</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#0000FF;">$record</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'state'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <a href="http://www.bradino.com/php-functions/trim/"><span style="color:#000066;">trim</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$location</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#0000FF;">$record</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'zip'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <a href="http://www.bradino.com/php-functions/trim/"><span style="color:#000066;">trim</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$location</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#616100;">for</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$i</span>=<span style="color:#CC66CC;">2</span>; <span style="color:#0000FF;">$i</span>&lt;=<span style="color:#CC66CC;">5</span>; <span style="color:#0000FF;">$i</span>++<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$detail</span> = <a href="http://www.bradino.com/php-functions/trim/"><span style="color:#000066;">trim</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$details</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$i</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.bradino.com/php-functions/substr/"><span style="color:#000066;">substr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$detail</span>,<span style="color:#CC66CC;">0</span>,<span style="color:#CC66CC;">6</span><span style="color:#006600; font-weight:bold;">&#41;</span>==<span style="color:#FF0000;">'Phone:'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#0000FF;">$record</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'phone'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <a href="http://www.bradino.com/php-functions/str_replace/"><span style="color:#000066;">str_replace</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Phone: '</span>,<span style="color:#FF0000;">''</span>,<span style="color:#0000FF;">$detail</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">else</span> <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.bradino.com/php-functions/substr/"><span style="color:#000066;">substr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$detail</span>,<span style="color:#CC66CC;">0</span>,<span style="color:#CC66CC;">4</span><span style="color:#006600; font-weight:bold;">&#41;</span>==<span style="color:#FF0000;">'Fax:'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#0000FF;">$record</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'fax'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <a href="http://www.bradino.com/php-functions/str_replace/"><span style="color:#000066;">str_replace</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Fax: '</span>,<span style="color:#FF0000;">''</span>,<span style="color:#0000FF;">$detail</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">else</span> <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.bradino.com/php-functions/substr/"><span style="color:#000066;">substr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$detail</span>,<span style="color:#CC66CC;">0</span>,<span style="color:#CC66CC;">4</span><span style="color:#006600; font-weight:bold;">&#41;</span>==<span style="color:#FF0000;">'Web:'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#0000FF;">$record</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'web'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <a href="http://www.bradino.com/php-functions/strip_tags/"><span style="color:#000066;">strip_tags</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.bradino.com/php-functions/str_replace/"><span style="color:#000066;">str_replace</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Web: '</span>,<span style="color:#FF0000;">''</span>,<span style="color:#0000FF;">$detail</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">else</span> <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.bradino.com/php-functions/substr/"><span style="color:#000066;">substr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$detail</span>,<span style="color:#CC66CC;">0</span>,<span style="color:#CC66CC;">6</span><span style="color:#006600; font-weight:bold;">&#41;</span>==<span style="color:#FF0000;">'Email:'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#0000FF;">$record</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'email'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <a href="http://www.bradino.com/php-functions/strip_tags/"><span style="color:#000066;">strip_tags</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.bradino.com/php-functions/str_replace/"><span style="color:#000066;">str_replace</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Email: '</span>,<span style="color:#FF0000;">''</span>,<span style="color:#0000FF;">$detail</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <a href="http://www.bradino.com/php-functions/print_r/"><span style="color:#000066;">print_r</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$record</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <a href="http://www.bradino.com/php-functions/die/"><span style="color:#000066;">die</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</div>
</div>
<p></p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/php scrape/" rel="tag">php scrape</a> <a href="http://www.bradino.com/search/screen scraping/" rel="tag">screen scraping</a> <a href="http://www.bradino.com/search/php screen scrape/" rel="tag">php screen scrape</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/php/php-screen-scraping/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Manually Run Webalizer via SSH - webstatmng</title>
		<link>http://www.bradino.com/misc/manually-run-webalizer/</link>
		<comments>http://www.bradino.com/misc/manually-run-webalizer/#comments</comments>
		<pubDate>Fri, 22 Feb 2008 17:23:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://www.bradino.com/misc/manually-run-webalizer/</guid>
		<description><![CDATA[In Plesk say you have a domain bradino.com and you have not enabled webalizer. Later you need to enable it but no statistics show because it only parses the log files once per day but you want the stats right now. Here is the SSH command you can run to manually run webalizer.
/usr/local/psa/admin/bin/webstatmng --calculate-rotated-statistics --stat-prog=webalizer [...]]]></description>
			<content:encoded><![CDATA[<p>In Plesk say you have a domain bradino.com and you have not enabled webalizer. Later you need to enable it but no statistics show because it only parses the log files once per day but you want the stats right now. Here is the SSH command you can run to manually run webalizer.</p>
<p><strong>/usr/local/psa/admin/bin/webstatmng --calculate-rotated-statistics --stat-prog=webalizer --domain-name=bradino.com</strong></p>
<p>I am sure that this is different for every system, but this worked for me running Plesk 8.1 on Linux.</p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/webalizer/" rel="tag">webalizer</a> <a href="http://www.bradino.com/search/webstatmng/" rel="tag">webstatmng</a> <a href="http://www.bradino.com/search/run webalizer/" rel="tag">run webalizer</a> <a href="http://www.bradino.com/search/run webalizer manually/" rel="tag">run webalizer manually</a> <a href="http://www.bradino.com/search/webstatmng command/" rel="tag">webstatmng command</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/misc/manually-run-webalizer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Http Authentication using PHP</title>
		<link>http://www.bradino.com/php/http-authentication-using-php/</link>
		<comments>http://www.bradino.com/php/http-authentication-using-php/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 23:13:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.bradino.com/php/http-authentication-using-php/</guid>
		<description><![CDATA[There are two easy ways to login to a page protected by htaccess using PHP. You need to have the username and password of course... Anyway, a good use for this is if you want to scrape a page behind an htaccess login, or if you need to do something progammatically behind htaccess password protection.
1) [...]]]></description>
			<content:encoded><![CDATA[<p>There are two easy ways to login to a page protected by htaccess using PHP. You need to have the username and password of course... Anyway, a good use for this is if you want to scrape a page behind an htaccess login, or if you need to do something progammatically behind htaccess password protection.</p>
<p>1) You can access the page as:<br />
<strong>http://username:password@domain.com/folder/page.php</strong></p>
<p>2) You can set an extra parameter in curl:</p>
<p><strong>curl_setopt($ch, CURLOPT_USERPWD, "username:password");</strong></p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/php htaccess login/" rel="tag">php htaccess login</a> <a href="http://www.bradino.com/search/php http authentication/" rel="tag">php http authentication</a> <a href="http://www.bradino.com/search/php htaccess/" rel="tag">php htaccess</a> <a href="http://www.bradino.com/search/php login/" rel="tag">php login</a> <a href="http://www.bradino.com/search/http authentication/" rel="tag">http authentication</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/php/http-authentication-using-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Automatically Login Bookmark</title>
		<link>http://www.bradino.com/misc/automatically-login-bookmark/</link>
		<comments>http://www.bradino.com/misc/automatically-login-bookmark/#comments</comments>
		<pubDate>Wed, 05 Dec 2007 19:13:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://www.bradino.com/misc/automatically-login-bookmark/</guid>
		<description><![CDATA[Here is a quick little trick to automate logging into online applications. Simply create an HTML file and put it on your desktop (or wherever you like), and then by opening this file, you can login to most applications automatically. All you have to change in the file is the url to post the form [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a quick little trick to automate logging into online applications. Simply create an HTML file and put it on your desktop (or wherever you like), and then by opening this file, you can login to most applications automatically. All you have to change in the file is the url to post the form to and the field names of the values to post. In this simple demo the form will post the variables "username" and "password" to https://www.domain.com/login.php.</p>
<div class="syntax_hilite">
<div id="html-10">
<div class="html"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;html&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;head&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title&gt;</span></span>Auto Login Script<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/head&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;body</span> <span style="color: #000066;">onload</span>=<span style="color: #ff0000;">"document.loginform.submit();"</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
Logging into Application...<br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;form</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"loginform"</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"loginform"</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">"post"</span> <br />
<span style="color: #000066;">action</span>=<span style="color: #ff0000;">"https://www.domain.com/login.php"</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"hidden"</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"username"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"admin"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"hidden"</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"password"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"secret"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/form&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html&gt;</span></span></div>
</div>
</div>
<p></p>
<p><strong>Warning:</strong> This is not secure, as the password is stored in plain-text and is accessible to anyone with access to your computer. Please use with extreme caution.</p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/auto login/" rel="tag">auto login</a> <a href="http://www.bradino.com/search/password manager/" rel="tag">password manager</a> <a href="http://www.bradino.com/search/automatically login/" rel="tag">automatically login</a> <a href="http://www.bradino.com/search/quick login/" rel="tag">quick login</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/misc/automatically-login-bookmark/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP Array of US States</title>
		<link>http://www.bradino.com/misc/php-array-of-us-states/</link>
		<comments>http://www.bradino.com/misc/php-array-of-us-states/#comments</comments>
		<pubDate>Mon, 03 Dec 2007 18:46:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://www.bradino.com/misc/php-array-of-us-states/</guid>
		<description><![CDATA[This simple array of states can be used to poulate a dropdown menu on a form, or in some kind of lookup from state code to name, or any loop action you desire. 


$states = array&#40;'AL'=&#62;"Alabama",&#160; 
&#160; &#160; &#160; &#160; 'AK'=&#62;"Alaska",&#160; 
&#160; &#160; &#160; &#160; &#160; &#160; 'AZ'=&#62;"Arizona",&#160; 
&#160; &#160; &#160; &#160; &#160; &#160; 'AR'=&#62;"Arkansas",&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>This simple array of states can be used to poulate a dropdown menu on a form, or in some kind of lookup from state code to name, or any loop action you desire. </p>
<div class="syntax_hilite">
<div id="php-13">
<div class="php"><span style="color:#0000FF;">$states</span> = <a href="http://www.bradino.com/php-functions/array/"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'AL'</span>=&gt;<span style="color:#FF0000;">"Alabama"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'AK'</span>=&gt;<span style="color:#FF0000;">"Alaska"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'AZ'</span>=&gt;<span style="color:#FF0000;">"Arizona"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'AR'</span>=&gt;<span style="color:#FF0000;">"Arkansas"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'CA'</span>=&gt;<span style="color:#FF0000;">"California"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'CO'</span>=&gt;<span style="color:#FF0000;">"Colorado"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'CT'</span>=&gt;<span style="color:#FF0000;">"Connecticut"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'DE'</span>=&gt;<span style="color:#FF0000;">"Delaware"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'DC'</span>=&gt;<span style="color:#FF0000;">"District Of Columbia"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'FL'</span>=&gt;<span style="color:#FF0000;">"Florida"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'GA'</span>=&gt;<span style="color:#FF0000;">"Georgia"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'HI'</span>=&gt;<span style="color:#FF0000;">"Hawaii"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'ID'</span>=&gt;<span style="color:#FF0000;">"Idaho"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'IL'</span>=&gt;<span style="color:#FF0000;">"Illinois"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'IN'</span>=&gt;<span style="color:#FF0000;">"Indiana"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'IA'</span>=&gt;<span style="color:#FF0000;">"Iowa"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'KS'</span>=&gt;<span style="color:#FF0000;">"Kansas"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'KY'</span>=&gt;<span style="color:#FF0000;">"Kentucky"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'LA'</span>=&gt;<span style="color:#FF0000;">"Louisiana"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'ME'</span>=&gt;<span style="color:#FF0000;">"Maine"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'MD'</span>=&gt;<span style="color:#FF0000;">"Maryland"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'MA'</span>=&gt;<span style="color:#FF0000;">"Massachusetts"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'MI'</span>=&gt;<span style="color:#FF0000;">"Michigan"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'MN'</span>=&gt;<span style="color:#FF0000;">"Minnesota"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'MS'</span>=&gt;<span style="color:#FF0000;">"Mississippi"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'MO'</span>=&gt;<span style="color:#FF0000;">"Missouri"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'MT'</span>=&gt;<span style="color:#FF0000;">"Montana"</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'NE'</span>=&gt;<span style="color:#FF0000;">"Nebraska"</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'NV'</span>=&gt;<span style="color:#FF0000;">"Nevada"</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'NH'</span>=&gt;<span style="color:#FF0000;">"New Hampshire"</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'NJ'</span>=&gt;<span style="color:#FF0000;">"New Jersey"</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'NM'</span>=&gt;<span style="color:#FF0000;">"New Mexico"</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'NY'</span>=&gt;<span style="color:#FF0000;">"New York"</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'NC'</span>=&gt;<span style="color:#FF0000;">"North Carolina"</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'ND'</span>=&gt;<span style="color:#FF0000;">"North Dakota"</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'OH'</span>=&gt;<span style="color:#FF0000;">"Ohio"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'OK'</span>=&gt;<span style="color:#FF0000;">"Oklahoma"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'OR'</span>=&gt;<span style="color:#FF0000;">"Oregon"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'PA'</span>=&gt;<span style="color:#FF0000;">"Pennsylvania"</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'PR'</span>=&gt;<span style="color:#FF0000;">"Puerto Rico"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'RI'</span>=&gt;<span style="color:#FF0000;">"Rhode Island"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'SC'</span>=&gt;<span style="color:#FF0000;">"South Carolina"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'SD'</span>=&gt;<span style="color:#FF0000;">"South Dakota"</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'TN'</span>=&gt;<span style="color:#FF0000;">"Tennessee"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'TX'</span>=&gt;<span style="color:#FF0000;">"Texas"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'UT'</span>=&gt;<span style="color:#FF0000;">"Utah"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'VT'</span>=&gt;<span style="color:#FF0000;">"Vermont"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'VA'</span>=&gt;<span style="color:#FF0000;">"Virginia"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'WA'</span>=&gt;<span style="color:#FF0000;">"Washington"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'WV'</span>=&gt;<span style="color:#FF0000;">"West Virginia"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'WI'</span>=&gt;<span style="color:#FF0000;">"Wisconsin"</span>,&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">'WY'</span>=&gt;<span style="color:#FF0000;">"Wyoming"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p>So a simple example to populate a dropdown form menu of states you could simply spin through the array like so:</p>
<div class="syntax_hilite">
<div id="php-14">
<div class="php"><span style="color:#616100;">foreach</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$states</span> <span style="color:#616100;">as</span> <span style="color:#0000FF;">$code</span> =&gt; <span style="color:#0000FF;">$state</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></p>
<p>&nbsp; &nbsp; &nbsp;<a href="http://www.bradino.com/php-functions/echo/"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"&lt;option value=<span style="color:#000099; font-weight:bold;">\"</span>{$code}<span style="color:#000099; font-weight:bold;">\"</span>&gt;{$state}&lt;/option&gt;<span style="color:#000099; font-weight:bold;">\n</span>"</span>;</p>
<p><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</div>
</div>
<p></p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/array of states/" rel="tag">array of states</a> <a href="http://www.bradino.com/search/usa states array/" rel="tag">usa states array</a> <a href="http://www.bradino.com/search/php states array/" rel="tag">php states array</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/misc/php-array-of-us-states/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Programmer Joke</title>
		<link>http://www.bradino.com/news/programmer-joke/</link>
		<comments>http://www.bradino.com/news/programmer-joke/#comments</comments>
		<pubDate>Wed, 28 Nov 2007 20:12:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.bradino.com/news/programmer-joke/</guid>
		<description><![CDATA[I heard this joke recently and thought that I should share it with fellow programmers:
Q: How many programmers does it take to change a lightbulb?
A: None - it's a hardware issue :)
programmer joke php programmer joke lightbulb joke]]></description>
			<content:encoded><![CDATA[<p>I heard this joke recently and thought that I should share it with fellow programmers:</p>
<p>Q: How many programmers does it take to change a lightbulb?</p>
<p>A: None - it's a hardware issue :)</p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/programmer joke/" rel="tag">programmer joke</a> <a href="http://www.bradino.com/search/php programmer joke/" rel="tag">php programmer joke</a> <a href="http://www.bradino.com/search/lightbulb joke/" rel="tag">lightbulb joke</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/news/programmer-joke/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Include Path</title>
		<link>http://www.bradino.com/php/include-path/</link>
		<comments>http://www.bradino.com/php/include-path/#comments</comments>
		<pubDate>Wed, 28 Nov 2007 17:44:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.bradino.com/php/include-path/</guid>
		<description><![CDATA[Often times you need to use the complete include path, not just the relative path. You can discover the complete include path, even if you are on a shared host, by examining the $_SERVER array. The SCRIPT_FILENAME value is the complete path to the file that is calling it. So an easy way to see [...]]]></description>
			<content:encoded><![CDATA[<p>Often times you need to use the complete include path, not just the relative path. You can discover the complete include path, even if you are on a shared host, by examining the $_SERVER array. The SCRIPT_FILENAME value is the complete path to the file that is calling it. So an easy way to see what the full path to a file is to put this line of code at the top of a file:</p>
<div class="syntax_hilite">
<div id="php-16">
<div class="php"><a href="http://www.bradino.com/php-functions/echo/"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'SCRIPT_FILENAME'</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</div>
</div>
<p></p>
<p>Now you know the complete path to where you are working with the files at. You can use the base include path in your classes or whatever.</p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/php include path/" rel="tag">php include path</a> <a href="http://www.bradino.com/search/$_SERVER array/" rel="tag">$_SERVER array</a> <a href="http://www.bradino.com/search/document root/" rel="tag">document root</a> <a href="http://www.bradino.com/search/base include/" rel="tag">base include</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/php/include-path/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP Variable Variables</title>
		<link>http://www.bradino.com/php/variable-variables/</link>
		<comments>http://www.bradino.com/php/variable-variables/#comments</comments>
		<pubDate>Tue, 20 Nov 2007 17:15:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.bradino.com/php/variable-variables/</guid>
		<description><![CDATA[In PHP sometimes you may want to have variable variables or dynamic function calls for whatever reason. PHP allows you to programmatically construct variable and function names. Here is an example of a variable function call from within a class. Thsi would call the function named myFunc:


$variable = 'myFunc';
$this-&#62;&#123;$variable&#125;&#40;&#41;;



Sometimes you may want to create variable [...]]]></description>
			<content:encoded><![CDATA[<p>In PHP sometimes you may want to have variable variables or dynamic function calls for whatever reason. PHP allows you to programmatically construct variable and function names. Here is an example of a variable function call from within a class. Thsi would call the function named myFunc:</p>
<div class="syntax_hilite">
<div id="php-19">
<div class="php"><span style="color:#0000FF;">$variable</span> = <span style="color:#FF0000;">'myFunc'</span>;<br />
<span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#0000FF;">$variable</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p>Sometimes you may want to create variable names on the fly, let's say in a loop where you are updating many records from a form post. This code would make a variable named commonCust and assign it a value of 1:</p>
<div class="syntax_hilite">
<div id="php-20">
<div class="php"><span style="color:#0000FF;">$custom</span> = <span style="color:#FF0000;">'Cust'</span>;<br />
$<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#FF0000;">'common'</span>.<span style="color:#0000FF;">$custom</span><span style="color:#006600; font-weight:bold;">&#125;</span> = <span style="color:#FF0000;">'1'</span>;</div>
</div>
</div>
<p></p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/variable variables/" rel="tag">variable variables</a> <a href="http://www.bradino.com/search/variable class variables/" rel="tag">variable class variables</a> <a href="http://www.bradino.com/search/dynamic variables/" rel="tag">dynamic variables</a> <a href="http://www.bradino.com/search/dynamic variable names/" rel="tag">dynamic variable names</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/php/variable-variables/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Javascript Split Function</title>
		<link>http://www.bradino.com/javascript/split-function/</link>
		<comments>http://www.bradino.com/javascript/split-function/#comments</comments>
		<pubDate>Tue, 20 Nov 2007 07:16:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.bradino.com/javascript/split-2/</guid>
		<description><![CDATA[The Javascript split() function works much the same as the php split() or explode() functions. Basically you take a string at break it up everywhere the delimiter character occurs and return the new strings in an array. So for example, let's say you have a string like this:
[script]var colorString = "red&#124;orange&#124;blue&#124;white&#124;black&#124;brown";[/script]
Which is obviously a simple [...]]]></description>
			<content:encoded><![CDATA[<p>The Javascript split() function works much the same as the php split() or explode() functions. Basically you take a string at break it up everywhere the delimiter character occurs and return the new strings in an array. So for example, let's say you have a string like this:</p>
<p>[script]var colorString = "red|orange|blue|white|black|brown";[/script]</p>
<p>Which is obviously a simple a pipe-delimited string of colors. So to make this into an array we would use the split function.</p>
<p>[script]var colorArray = colorString.split("|");[/script]</p>
<p>Now you have a simple array of colors and can access them as you would any array, either in a loop or by the numeric index, whatever...</p>
<p>[script]<br />
var message = "My favorite color is " + colorArray[3] ;<br />
alert(message);<br />
[/script]</p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/javascript split/" rel="tag">javascript split</a> <a href="http://www.bradino.com/search/javascript explode/" rel="tag">javascript explode</a> <a href="http://www.bradino.com/search/split/" rel="tag">split</a> <a href="http://www.bradino.com/search/javascript string manipulation/" rel="tag">javascript string manipulation</a></div>]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/javascript/split-function/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
