Playing with new ideas
Lately, I’ve been experimenting with some new ideas and approaches.
I built a new framework last month for some rapid PHP development and my first project was a stats system that I am using to record some analytics for a couple sites.
When it is ready, the site will be released for others to join, but for now, it is just for myself and a few other colleagues to play with.
I’ve gotten the reports working to the point that I can view trends over the past week to see what pages and keywords are getting traffic and which ones are not. This can have a big impact when it comes to affiliate marketing to see which pages of a site work and which ones don’t.
I’ve also gotten a few other reports worked in that are pretty unique to analytics sysems, but I’ll wait til the site is done before getting into them all
Overture Keyword Extractor using PHP
After looking around for a class that would extract keywords from the Overture Keyword Inventory database, I decided it was just as well to do up my own class.
You can use this to look up keywords and view the results. Hope you find it useful.
<span style="color: #000000;"><code>01 |
<span style="color: #000000;">02</span> <span style="color: #0000bb;"><?</span> |
<span style="color: #000000;">03</span> <span style="color: #007700;">    class </span><span style="color: #0000bb;">OvertureSuggest </span><span style="color: #007700;">{</span> |
<span style="color: #000000;">04</span> <span style="color: #007700;">        private </span><span style="color: #0000bb;">$BaseWords</span><span style="color: #007700;">;</span> |
<span style="color: #000000;">05</span> <span style="color: #007700;">        </span><span style="color: #ff8000;">/** constructor */</span> |
<span style="color: #000000;">06</span> <span style="color: #007700;">        function </span><span style="color: #0000bb;">__construct</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$BaseWords</span><span style="color: #007700;">) {</span> |
<span style="color: #000000;">07</span> <span style="color: #007700;">            </span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-></span><span style="color: #0000bb;">BaseWords </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$BaseWords</span><span style="color: #007700;">;</span> |
<span style="color: #000000;">08</span> <span style="color: #007700;">Â Â Â Â Â Â Â Â }</span> |
<span style="color: #000000;">09</span> <span style="color: #007700;">        function </span><span style="color: #0000bb;">getSuggestions</span><span style="color: #007700;">() {</span> |
<span style="color: #000000;">10</span> <span style="color: #007700;">            </span><span style="color: #0000bb;">$query </span><span style="color: #007700;">= </span><span style="color: #dd0000;">'http://inventory.overture.com/d/searchinventory/suggestion/'</span><span style="color: #007700;">;</span> |
<span style="color: #000000;">11</span> <span style="color: #007700;">            </span><span style="color: #0000bb;">$query </span><span style="color: #007700;">.= </span><span style="color: #dd0000;">'?term='</span><span style="color: #007700;">.</span><span style="color: #0000bb;">urlencode</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-></span><span style="color: #0000bb;">mBaseWords</span><span style="color: #007700;">).</span><span style="color: #dd0000;">'&mkt=us&lang=en_US'</span><span style="color: #007700;">;</span> |
<span style="color: #000000;">12</span> <span style="color: #007700;">            </span><span style="color: #0000bb;">$data </span><span style="color: #007700;">= </span><span style="color: #0000bb;">file_get_contents</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$query</span><span style="color: #007700;">);</span> |
<span style="color: #000000;">13</span> <span style="color: #007700;">            </span><span style="color: #0000bb;">$data </span><span style="color: #007700;">= </span><span style="color: #0000bb;">strip_tags</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$data</span><span style="color: #007700;">);</span> |
<span style="color: #000000;">14</span> <span style="color: #007700;">            </span><span style="color: #0000bb;">$pattern </span><span style="color: #007700;">= </span><span style="color: #dd0000;">"/ ([0-9]+)n (.+)/i"</span><span style="color: #007700;">;</span> |
<span style="color: #000000;">15</span> <span style="color: #007700;">Â Â Â Â Â Â Â Â Â Â Â Â </span><span style="color: #0000bb;">preg_match_all</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$pattern</span><span style="color: #007700;">,</span><span style="color: #0000bb;">$data</span><span style="color: #007700;">,</span><span style="color: #0000bb;">$Matches</span><span style="color: #007700;">);</span> |
<span style="color: #000000;">16</span> <span style="color: #007700;">Â Â Â Â Â Â Â Â Â Â Â Â </span> |
<span style="color: #000000;">17</span> <span style="color: #007700;">            </span><span style="color: #0000bb;">$Cnts </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$Matches</span><span style="color: #007700;">[</span><span style="color: #0000bb;">1</span><span style="color: #007700;">];</span> |
<span style="color: #000000;">18</span> <span style="color: #007700;">            </span><span style="color: #0000bb;">$Words </span><span style="color: #007700;">= array();</span> |
<span style="color: #000000;">19</span> <span style="color: #007700;">            for (</span><span style="color: #0000bb;">$i</span><span style="color: #007700;">=</span><span style="color: #0000bb;">0</span><span style="color: #007700;">;</span><span style="color: #0000bb;">$i</span><span style="color: #007700;"><</span><span style="color: #0000bb;">count</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$Matches</span><span style="color: #007700;">[</span><span style="color: #0000bb;">2</span><span style="color: #007700;">]);</span><span style="color: #0000bb;">$i</span><span style="color: #007700;">++) {</span> |
<span style="color: #000000;">20</span> <span style="color: #007700;">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â </span><span style="color: #0000bb;">$Words</span><span style="color: #007700;">[</span><span style="color: #0000bb;">$Matches</span><span style="color: #007700;">[</span><span style="color: #0000bb;">2</span><span style="color: #007700;">][</span><span style="color: #0000bb;">$i</span><span style="color: #007700;">]]Â =Â </span><span style="color: #0000bb;">intval</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$Cnts</span><span style="color: #007700;">[</span><span style="color: #0000bb;">$i</span><span style="color: #007700;">]);</span> |
<span style="color: #000000;">21</span> <span style="color: #007700;">Â Â Â Â Â Â Â Â Â Â Â Â }</span> |
<span style="color: #000000;">22</span> <span style="color: #007700;">            return </span><span style="color: #0000bb;">$Words</span><span style="color: #007700;">;</span> |
<span style="color: #000000;">23</span> <span style="color: #007700;">Â Â Â Â Â Â Â Â }</span> |
<span style="color: #000000;">24</span> <span style="color: #007700;">Â Â Â Â }</span> |
<span style="color: #000000;">25</span> <span style="color: #007700;">Â Â Â Â </span> |
<span style="color: #000000;">26</span> <span style="color: #007700;">    </span><span style="color: #ff8000;">// Sample Usage:</span> |
<span style="color: #000000;">27</span>     $suggest = new OvertureSuggest('Affiliate'); |
<span style="color: #000000;">28</span>     echo "<pre>".print_r ($suggest->getSuggestions(),true)."</pre>"; |
<span style="color: #000000;">29</span> Â Â Â Â exit;Â Â Â Â |
<span style="color: #000000;">30</span> <span style="color: #0000bb;">?></span> |
<span style="color: #000000;">31</span> |
New DevShed Article
DevShed.com has just published another article written by me.
It’s called “Building a Relational Content Management System In PHP / MySQL”
A quick overview of the article as if the name doesn’t say it all is this:
“This article will show you how to build a simple relational content management system. What is a relational CMS you ask? Well, a relational CMS lets you create articles that have child articles.
This works similiar to other CMSes which have categories and then articles; we will just combine them together to be more relational.”
New Article on DevShed.com
DevShed.com has just published another article written by me.
It’s called “Building a Simple Affiliate Systems In PHP / MySQL”
A quick overview of the article as if the name doesn’t say it all is this:
“Setting up an affiliate system on your website can be very lucrative. While there are a lot of details involved, it need not be overly complicated. This article walks you through the steps of creating and setting up a basic affiliate system”
View it here: on DevShed.com