<?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>phpPig &#187; Code</title>
	<atom:link href="http://phppig.org/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://phppig.org</link>
	<description>PHP scripts and code to help newbies</description>
	<lastBuildDate>Mon, 25 Jul 2011 07:50:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Creating a php script to sell products</title>
		<link>http://phppig.org/193/creating-a-php-script-to-sell-products/</link>
		<comments>http://phppig.org/193/creating-a-php-script-to-sell-products/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 08:41:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://phppig.org/?p=193</guid>
		<description><![CDATA[<p>Ever wonder how some people are able to get sites up and going giving them access to update the content on the site and add pages of new products without knowing a single thing about html?</p>
<p>Marketing a new and exciting product is just one way to make money online. You will find that there is much <span style="color:#777"> . . . &#8594; Read More: <a href="http://phppig.org/193/creating-a-php-script-to-sell-products/">Creating a php script to sell products</a></span>]]></description>
			<content:encoded><![CDATA[<p>Ever wonder how some people are able to get sites up and going giving them access to update the content on the site and add pages of new products without knowing a single thing about html?</p>
<p>Marketing a new and exciting product is just one way to make money online. You will find that there is much more money to be made when you have a service to offer people who are just starting out online. </p>
<p>Follow this series of posts in the members section. By the end of the posts, you will have a working content management system with a shopping cart that ACTUALLY works! Plus, you can learn how to <strong>manipulate php to appear as different file types</strong>, build a MySQL database, build a functioning script that works around the MySQL database, and how to write files on the fly&#8230;.Plus let&#8217;s not forget about the making php code to look and quack like xml, yet it is really still php!</p>
<p>We will include all sorts of tools that <i><b><u>EVERY WEBMASTER AND USER NEEDS AND DESIRES</u></b></i>. Goodies will include: RSS feed of products, on the fly XML sitemap, podcasting abilities, RSS feed for podcasts that goes directly to iTunes, shopping cart that will work with paypal (will also show you how to use it with clickbank), easy to use WYSIWYG editor in the admin area that gives you COMPLETE CONTROL over the page being created, and much, much more!</p>
<p>To view a sample of the script that we will be coding, visit <a href="http://scottpdaugherty.com">my personal website</a>. I coded this script and will include the source code to the WHOLE PROJECT as a download at the end of the tutorial.</p>
<p>You won&#8217;t want to miss this advanced lesson on how to create your own working php script that you can customize and sell to people, gaining you respect as a coder and giving your customer a very useful product that they will very likely pay hundreds or thousands of dollars for!</p>
<p>Look in the Member&#8217;s Only section to read this series of articles.</p>
]]></content:encoded>
			<wfw:commentRss>http://phppig.org/193/creating-a-php-script-to-sell-products/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amazon, CJ, and eBay WordPress classes</title>
		<link>http://phppig.org/184/amazon-cj-and-ebay-wordpress-classes/</link>
		<comments>http://phppig.org/184/amazon-cj-and-ebay-wordpress-classes/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 08:01:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>
		<category><![CDATA[amazon associate webservices]]></category>
		<category><![CDATA[cj webservices]]></category>
		<category><![CDATA[ebay partner network]]></category>

		<guid isPermaLink="false">http://phppig.org/?p=184</guid>
		<description><![CDATA[<p>I am considering having a member&#8217;s only area where member will be able to view and download source code for Amazon, commission junction and eBay affiliate program plugins. </p>
<p>Still just thinking about it now. If this were to happen, how many people would actually be interested in this? Comment to this post if you would be <span style="color:#777"> . . . &#8594; Read More: <a href="http://phppig.org/184/amazon-cj-and-ebay-wordpress-classes/">Amazon, CJ, and eBay WordPress classes</a></span>]]></description>
			<content:encoded><![CDATA[<p>I am considering having a member&#8217;s only area where member will be able to view and download source code for Amazon, commission junction and eBay affiliate program plugins. </p>
<p>Still just thinking about it now. If this were to happen, how many people would actually be interested in this? Comment to this post if you would be interested in viewing and downloading source code, having videos readily available on how to use the code, and instructions on how to make plugins and making your own comparison shopping plugin. Maybe even have code samples and instructions on how to make your own complete affiliate script!</p>
<p>Debating on it&#8230;.Let me know what you think.</p>
]]></content:encoded>
			<wfw:commentRss>http://phppig.org/184/amazon-cj-and-ebay-wordpress-classes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Protected: CJ Webservices REST API call code</title>
		<link>http://phppig.org/161/cj-webservices-rest-api-call/</link>
		<comments>http://phppig.org/161/cj-webservices-rest-api-call/#comments</comments>
		<pubDate>Sun, 29 Aug 2010 22:57:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://phppig.org/?p=161</guid>
		<description><![CDATA[There is no excerpt because this is a protected post.]]></description>
			<content:encoded><![CDATA[<form action="http://phppig.org/wp-pass.php" method="post">
<p>This post is password protected. To view it please enter your password below:</p>
<p><label for="pwbox-161">Password:<br />
<input name="post_password" id="pwbox-161" type="password" size="20" /></label><br />
<input type="submit" name="Submit" value="Submit" /></p></form>
]]></content:encoded>
			<wfw:commentRss>http://phppig.org/161/cj-webservices-rest-api-call/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Learn How to Code php From Home</title>
		<link>http://phppig.org/136/learn-how-to-code-php-from-home/</link>
		<comments>http://phppig.org/136/learn-how-to-code-php-from-home/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 06:42:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://phppig.org/?p=136</guid>
		<description><![CDATA[﻿<p>There are many ways to learn php from home. There is a vast amount of information on the web to teach one how to program php, though I recommend getting a book to keep as a reference manual in the future.</p>
<p>Once you have a book, install mysql and Apache on your machine and start coding locally <span style="color:#777"> . . . &#8594; Read More: <a href="http://phppig.org/136/learn-how-to-code-php-from-home/">Learn How to Code php From Home</a></span>]]></description>
			<content:encoded><![CDATA[<p>There are many ways to learn php from home. There is a vast amount of information on the web to teach one how to program php, though I recommend getting a book to keep as a reference manual in the future.</p>
<p>Once you have a book, install mysql and Apache on your machine and start coding locally in a non-production environment. This will allow you to do two things:<br />
1.) Debug your code before putting up for the public.<br />
2.) Keep a copy on your local machine for future upgrades that you would want to make to the code.</p>
<p>Below, I have listed a couple of books that I recommend you to read before trying to code a project yourself. </p>
<table border="0"><tr><td><h2><font size="3">PHP and MySQL Web Development (4th Edition)</font></h2></a><br><font size="2"><b>$31.18 </font></b><br><img src="http://ecx.images-amazon.com/images/I/51QGM-5H%2BLL._SL160_.jpg" title="PHP and MySQL Web Development (4th Edition)" border="0"></a><br>PHP and MySQL are popular open-source technologies that are ideal for quickly developing database-driven Web applications. PHP is a powerful scripting language designed to enable developers to create highly featured Web applications quickly, and MySQL is a fast, reliable database that integrates well with PHP and is suited for dynamic Internet-based applications. <p style="margin: 0px;"> </p> <p style="margin: 0px;"><i>PHP and MySQL Web Development</i> shows how to use these tools together to produce effective, interactive Web applications. It clearly describes the basics of the PHP language, explains how to set up and work with a MySQL database, and then shows how to use PHP to interact with the database and the server. </p> <p style="margin: 0px;"> </p> <p style="margin: 0px;">This practical, hands-on book includes numerous examples that demonstrate common tasks such as authenticating users, constructing a shopping cart, generating PDF documents and images dynamically, sending and managing email, facilitating user discussions, connecting to Web services using XML, and developing Web 2.0 applications with Ajax-based interactivity.</p> <p style="margin: 0px;"> </p> <p style="margin: 0px;">The fourth edition of <i>PHP and MySQL Web Development</i> has been thoroughly updated, revised, and expanded to cover developments in PHP 5 through version 5.3, such as namespaces and closures, as well as features introduced in MySQL 5.1.</p><p style="margin: 0px;"> </p><p style="margin: 0px;"><br></p><p style="margin: 0px;"> </p> <br></td></tr>
<tr><td><form action="/go.php?PHP_and_MySQL_Web_Development_4th_Edition" method="post" enctype="multipart/form-data"><input name="link" type="hidden" value="http://www.amazon.com/PHP-MySQL-Web-Development-4th/dp/0672329166%3FSubscriptionId%3D05VTE22MFHGQ29ZMNK82%26tag%3Dhttprockbotto-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0672329166" /><input type="image" name="Submit" src="http://phppig.org/wp-content/plugins/ActionAffiliate/images/more.jpg" /></form>
</td></tr></table> <a title="HARDWARE RAID WEB SERVER 8 GIG RAM 4 X 400GB SATA   AND GUI PHP MYSQL DNS MAIL"  href="http://rover.ebay.com/rover/1/711-53200-19255-0/1?icep_ff3=2&amp;toolid=10005&campid=5335866424&amp;customid=EZnichestore&icep_item=200618415710&ipn=psmain&icep_vectorid=229466&kwid=902099&mtid=824&kw=rss" target="_blank" ><b>HARDWARE RAID WEB SERVER 8 GIG RAM 4 X 400GB SATA   AND GUI PHP MYSQL DNS MAIL</b></a><table border="0" cellpadding="8"><tr><td><a title="HARDWARE RAID WEB SERVER 8 GIG RAM 4 X 400GB SATA   AND GUI PHP MYSQL DNS MAIL" href="http://rover.ebay.com/rover/1/711-53200-19255-0/1?icep_ff3=2&amp;toolid=10005&campid=5335866424&amp;customid=EZnichestore&icep_item=200618415710&ipn=psmain&icep_vectorid=229466&kwid=902099&mtid=824&kw=rss"><img border="0" src="http://thumbs.ebaystatic.com/pict/200618415710_0.jpg" /></a></td><td><strong>US $525.00</strong><br /> End Date: Saturday Feb-04-2012 20:00:52 PST<br />Buy It Now for only: US $525.00<br /><a title="HARDWARE RAID WEB SERVER 8 GIG RAM 4 X 400GB SATA   AND GUI PHP MYSQL DNS MAIL" href="http://rover.ebay.com/rover/1/711-53200-19255-0/1?icep_ff3=2&amp;toolid=10005&campid=5335866424&amp;customid=EZnichestore&icep_item=200618415710&ipn=psmain&icep_vectorid=229466&kwid=902099&mtid=824&kw=rss">Buy it now</a> | <a title="HARDWARE RAID WEB SERVER 8 GIG RAM 4 X 400GB SATA   AND GUI PHP MYSQL DNS MAIL" href="http://rover.ebay.com/rover/1/711-53200-19255-0/1?ff3=4&amp;toolid=10005&campid=5335866424&amp;customid=EZnichestore&amp;mpre=http%3A%2F%2Fcgi1.ebay.com%2Fws%2FeBayISAPI.dll%3FMfcISAPICommand%3DMakeTrack%26item%3D200618415710%26ssPageName%3DRSS%3AB%3ASRCH%3AUS%3A104">Add to watch list</a></td></tr></table><hr size="1" noshade="noshade" />
<p>What are the benefits of do-it-yourself coding when there are so many freelancers one may ask. In the long run, if you are going to run an independent site (or multiple sites) you will save a lot of money by coding it yourself.</p>
]]></content:encoded>
			<wfw:commentRss>http://phppig.org/136/learn-how-to-code-php-from-home/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting Cookies With PHP</title>
		<link>http://phppig.org/88/setting-cookies-with-ph/</link>
		<comments>http://phppig.org/88/setting-cookies-with-ph/#comments</comments>
		<pubDate>Mon, 17 May 2010 21:01:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://phppig.org/?p=88</guid>
		<description><![CDATA[<p>I am currently adding a shopping cart to a CMS script that I have written. The object is to eventually have a script that many people will find useful on their sites by allowing them to generate traffic from their articles as well as from their shop. In this post, I will discuss some of the <span style="color:#777"> . . . &#8594; Read More: <a href="http://phppig.org/88/setting-cookies-with-ph/">Setting Cookies With PHP</a></span>]]></description>
			<content:encoded><![CDATA[<p>I am currently adding a shopping cart to a <a href="http://thecollard.com/" target="_blank">CMS script</a> that I have written. The object is to eventually have a script that many people will find useful on their sites by allowing them to generate traffic from their articles as well as from their shop. In this post, I will discuss some of the code used to make the cart work, how it works, and how I will implement the code into my own script, which again is available for free download at <http://thecollard.com" target="_blank">The Collard</a>.</p>
<p>One of the first things that I needed to do was create sessions. This will allow my users to create a unique session and only allow the products added to their cart during the visit from their machine. In the previous versions of the collard, their was no session variables defined so I set this up by editing the functions.php file of this script. If you are not using this script, you will need to create a functions.php page and add this function to that page.</p>
<p><code>&lt;?php<br />
function Session()<br />
{<br />
//This will generate an encrypted string and will set the cookie. It will also be used in the cookieId field in the<br />
//cart<br />
if(isset($_COOKIE["cartid"]))<br />
{<br />
return $_COOKIE["cartId"];<br />
}<br />
else<br />
{<br />
//No cookie was found. We will set the cookie and return the session ID<br />
session_start();<br />
setcookie("cartId",session_id(),time()+((3600*24)*30);<br />
return session_id;<br />
}<br />
}<br />
?&gt;</code></p>
<p>This code has now created session ids and will return to that session id if visited again within the next 30 days. This allows the user to add products to a cart and if they decide to think about it, need to wait until payday, etc., the products are now in the shopping cart and will be available to them when they come back to complete the purchase.</p>
<p>Now to explain how I did this. I used the setcookie function to create the cookie on their machine. In order for this cookie to work for the next 30 days, I defined that by adding the time function to the string. There are 3600 seconds in every hour (60*60). I multiply that by 24 hours in a day and then by 30 days in a month. That sets the cookie to last exactly 30 days from the moment it was created.</p>
]]></content:encoded>
			<wfw:commentRss>http://phppig.org/88/setting-cookies-with-ph/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a sufficient php site</title>
		<link>http://phppig.org/35/building-a-sufficient-php-site/</link>
		<comments>http://phppig.org/35/building-a-sufficient-php-site/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 06:32:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://phppig.org/?p=35</guid>
		<description><![CDATA[<p>To get more popular search engine rank, a new webmaster must make sure that they do their keywords homework. There are several ways to do this, with Wordtracker being the most popular. Once you have done your homework and have great keyword phrases, then register your domain and start building your site.</p>
<p>If you are running a <span style="color:#777"> . . . &#8594; Read More: <a href="http://phppig.org/35/building-a-sufficient-php-site/">Building a sufficient php site</a></span>]]></description>
			<content:encoded><![CDATA[<p>To get more popular search engine rank, a new webmaster must make sure that they do their keywords homework. There are several ways to do this, with <a href="http://wordtracker.com">Wordtracker</a> being the most popular. Once you have done your homework and have great keyword phrases, then register your domain and start building your site.</p>
<p>If you are running a php/mysql website, then you will have urls that look like this: http://yoursite.com/index.php?task=view&#038;id=1 or something of that nature. You can change the urls, if your server allows for ModRewrite by utilizing a small file that is planted on the server. The file name is .htaccess. Now, to rewrite the files, you will need to write the file in a text editor and simply save as .htaccess or .htaccess.txt and rename on server by removing the .txt extension. In this file, using a url like the one listed above, you will want to write the .htaccess like this:</p>
<p><code><br />
Options -Indexes<br />
RewriteEngine on<br />
RewriteRule ^([0-9]+)-([a-zA-Z0-9?-]+) index.php?task=view&#038;id=$1&#038;name=$2 [L]<br />
RewriteBase /<br />
</code></p>
<p>Now is time for the php code to rename the urls. This can be done in a separate php file if so desired or on the pages that query for the urls on the site. If you use the latter, your code can look something like this.<br />
<code><br />
&lt;?php<br />
$sql = mysql_query("SELECT * FROM table_in_datbase_where_info_is");<br />
$row = mysql_fetch_assoc($sql);<br />
$url_1 = $row['id'].'-'.$row['name'];<br />
</code><br />
That will query the database and get you a link that would look like this:<br />
1-Your url name<br />
Now that we have done this, we will use php str_replace to make the link look friendlier.<br />
<code><br />
$url_1 = str_replace(" ","_",$url_1);<br />
</code><br />
That will remove the spaces and replace them with an underscore. Now to tie it all in together:<br />
<code><br />
$url = "http://yoursite.com/".$url_1.".html";<br />
echo "&lt;a href='".$url."'&gt;$row['name']&lt;/a&gt;";<br />
?&gt;<br />
</code><br />
This will now make your urls look like this: http://yoursite.com/1-Your_page_or_post_name.html. With the .htaccess file that we placed earlier, it will look for that url and place it with the same url as before based on the id of your page being 1 or the first entry found in your database. It will automatically rename every entry in the database in that table and will increase your sites search engine popularity.</p>
<p>When your url matches the keywords of the popular searched phrase with little competition, you will soon start to see a steady flow of traffic from the search engines. </p>
]]></content:encoded>
			<wfw:commentRss>http://phppig.org/35/building-a-sufficient-php-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mod_rewrite with .htacess to change links in rss feed</title>
		<link>http://phppig.org/30/mod_rewrite-with-htacess-to-change-links-in-rss-feed/</link>
		<comments>http://phppig.org/30/mod_rewrite-with-htacess-to-change-links-in-rss-feed/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 09:07:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://phppig.org/?p=30</guid>
		<description><![CDATA[<p>The last post, we showed you how to add datafeeds to a site utilizing php and the MagpieRSS script. In this post, I am going to show you how to go one step further for search engine optimization using your .htaccess file and the str_replace command in php.</p>
<p>In the last post, I showed you how to <span style="color:#777"> . . . &#8594; Read More: <a href="http://phppig.org/30/mod_rewrite-with-htacess-to-change-links-in-rss-feed/">Mod_rewrite with .htacess to change links in rss feed</a></span>]]></description>
			<content:encoded><![CDATA[<p>The last post, we showed you how to add datafeeds to a site utilizing php and the MagpieRSS script. In this post, I am going to show you how to go one step further for search engine optimization using your .htaccess file and the str_replace command in php.</p>
<p>In the last post, I showed you how to use an rss feed from craigslist and incorporate it into your site. This time, I am going to show you how to take the same feed and rename all urls in the feed to urls that are more appropriate to your site. </p>
<p>I cannot be sure how this will react with wordpress because I have not tried it yet, however, I am going to give it a shot tomorrow and see what needs to be changed and will write a post about that.</p>
<p>In the last post, we pointed you to <a href="http://scottpdaugherty.com/mobile-al-boat-classifieds/" target="_blank">Boat Classifieds</a>. Since the last post, I have taken all of the links from that by removing the $href statement.</p>
<p>Now if you have a custom php script or would like to run this with no style, feel free to copy this into wordpad and save as index.php or whatever you choose to rename it. </p>
<p>Okay, enough of the talk, here is the code:<br />
<code>Options -Indexes<br />
RewriteEngine on<br />
RewriteRule ^boat_classifieds/([0-9]+)-([a-zA-Z0-9?-]+) http://mobile.craigslist.org/boa/$1.html</code><br />
Now to discuss what we are doing. This is telling your server to redirect all links that appear like this: www.yoursite.com/boat_classifieds/1-This_is_your_boat_ad.html to craigslist. The $1 tells the file that the first string of the url defined ([0-9]+) is the string that it will redirect to.</p>
<p>Now for the php code to actually rewrite the urls so that the urls listed actually appear to belong to your site.<code>&lt;?php<br />
require_once('magpierss/rss_fetch.inc');<br />
$url = "http://mobile.craigslist.org/boa/index.rss";<br />
$rss = fetch_rss ( $url );<br />
echo "&lt;ul&gt;";<br />
foreach ($rss->items as $item) {<br />
$href = $item['link'];<br />
$title = $item['title'];<br />
$title1 = seo_str($title);<br />
$href1 = str_replace("http://mobile.craigslist.org/boa/","",$href);<br />
$href1 = str_replace(".html","",$href1);<br />
$href = $site_url.'/boat_classifieds/'.$href1.'-'.$title1.'.html';<br />
$description = $item['description'];<br />
$description = str_replace("a href","a target='_blank' rel='nofollow' title='$title' href", $description);<br />
echo"&lt;li&gt;&lt;a href=$href target='_blank' rel='follow' title='$title&gt;&lt;h2>$title&lt;/h2>lt;/a>&lt;/li> &lt;p>$description&lt;/p>";<br />
}<br />
echo"&lt;/ul>";<br />
?></code><br />
In this code, on line 3 we define the rss feed that we are going to show on our site. Lines 6-8 grab the information from the rss feed. On line 9 we define a function that will be useful for Search Engine Optimization by replacing all irregular characters with an underscore. In the rest of the code, we define the links, description, and then show them in html with the echo command. Specifically, lines 18-20 define the new url that we are going to redirect. On line 22 we redefine how the link opens so that it opens in a new window or tab and allows your original window open.</p>
<p>Preview the code here at <a href="http://alabamatombigbeefishing.info/boat_classifieds/mobile_al.html" target="_blank">Mobile Alabama Boat Classifieds</a>.<br />
You may copy this code now and test it, modify or etc, as you see fit.</p>
]]></content:encoded>
			<wfw:commentRss>http://phppig.org/30/mod_rewrite-with-htacess-to-change-links-in-rss-feed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding RSS or XML to php site</title>
		<link>http://phppig.org/25/adding-rss-or-xml-to-php-site/</link>
		<comments>http://phppig.org/25/adding-rss-or-xml-to-php-site/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 16:58:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://phppig.org/?p=25</guid>
		<description><![CDATA[<p>A lot of people locally have asked me how to add an xml or rss feed to their site. A lot of people may wonder what the benefits of adding a feed to your site and basically it keeps fresh content updating to your site. If the search engines come by and snap what you have <span style="color:#777"> . . . &#8594; Read More: <a href="http://phppig.org/25/adding-rss-or-xml-to-php-site/">Adding RSS or XML to php site</a></span>]]></description>
			<content:encoded><![CDATA[<p>A lot of people locally have asked me how to add an xml or rss feed to their site. A lot of people may wonder what the benefits of adding a feed to your site and basically it keeps fresh content updating to your site. If the search engines come by and snap what you have got from your own personal content, then more content from a feed, it helps you get more traffic for different keywords.</p>
<p>It is rather simple, so simple that anybody can do it, techie or non-techie. I am going to show you how to do it briefly and then send you to a demo page to see it in action. First, you will need an rss aggregator script. The best free script to download is magpie. You can download it <a href="http://sourceforge.net/projects/magpierss/files/" target="_blank">here</a>.</p>
<p>For this post, I downloaded Magpie RSS 0.72 and extracted it to a folder on my local machine. If you don&#8217;t have a good zip program, you can download 7zip for free <a href="http://www.7-zip.org/download.html" target="_blank">here</a>. Once you extract the Magpie archive, it should automatically unzip to folder magpierss-0.72. You will want to rename the folder magpierss.</p>
<p>Next you will need to FTP this folder into your webhost. If you don&#8217;t have good FTP software, you can download Filezilla for free <a href="http://filezilla-project.org/download.php" target="_blank">here</a>. It is Open Source and very fast.</p>
<p>Now once this is done, on the php page that you want the feed to appear, somewhere in the code you will need to add the following line:<br />
<code>&lt;?php<br />
require_once('magpierss/rss_fetch.inc');<br />
?&gt;</code></p>
<p>Once you add that bit of code to the page, wherever you want the rss feed to appear, add the following code:<br />
<code>&lt;?php<br />
$url = "your_url_here";<br />
$rss = fetch_rss ( $url );<br />
echo "Channel Title: " . $rss-&gt;channel['title'] . "&lt;p&gt;";<br />
echo "&lt;ul&gt;";<br />
foreach ($rss-&gt;items as $item) {<br />
$href = $item['link'];<br />
$title = $item['title'];<br />
$description = $item['description'];<br />
echo"&lt;li&gt;&lt;a href=$href&gt;$title&lt;/a&gt;&lt;/li&gt;&lt;p&gt;$description&lt;/p&gt;";<br />
}<br />
echo"&lt;/ul&gt;";<br />
?&gt;</code></p>
<p>If you use wordpress like I am using for this and my other blog, you can easily manipulate an rss feed into any page that you want to in your blog by adding the EXEC-PHP plugin for wordpress. It can be downloaded here: <a href="http://bluesome.net/post/2005/08/18/50/" target="_blank">http://bluesome.net/post/2005/08/18/50/</a>.Â  Once you install the EXEC-PHP plugin, activate it and then paste the code above into any page of your blog by changing the following line:</p>
<p>$url = &#8220;your_url_here&#8221;;</p>
<p>Change the your_url_here to the url of the feed that you want to add to your site. Whenever you publish this, it goes live and is available for all of your site&#8217;s visitors.</p>
<p>Preview <a href="http://scottpdaugherty.com/tombigbee-river-level-leroy-al/" target="_blank">here</a> and <a href="http://scottpdaugherty.com/mobile-al-boat-classifieds/" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://phppig.org/25/adding-rss-or-xml-to-php-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CJ affiliates and eBay affiliates: Prepare for a new set of free tools</title>
		<link>http://phppig.org/22/cj-affiliates-and-ebay-affiliates-prepare-for-a-new-set-of-free-tools/</link>
		<comments>http://phppig.org/22/cj-affiliates-and-ebay-affiliates-prepare-for-a-new-set-of-free-tools/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 07:26:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://phppig.org/?p=22</guid>
		<description><![CDATA[<p>I have been showing you how to add links to your wordpress sites using the CJ api service but the code is almost ready to upload for a brand new CMS. The script will be released under GNU/GPL and will feature plug-ins that will search the CJ advertiser of your choice for your keywords in both <span style="color:#777"> . . . &#8594; Read More: <a href="http://phppig.org/22/cj-affiliates-and-ebay-affiliates-prepare-for-a-new-set-of-free-tools/">CJ affiliates and eBay affiliates: Prepare for a new set of free tools</a></span>]]></description>
			<content:encoded><![CDATA[<p>I have been showing you how to add links to your wordpress sites using the CJ api service but the code is almost ready to upload for a brand new CMS. The script will be released under GNU/GPL and will feature plug-ins that will search the CJ advertiser of your choice for your keywords in both your article posting and page posting.</p>
<p>The script features a user-friendly admin section and an SEO friendly front-end that will guarantee that your site gets higher optimization and you can start making profits strictly from organic traffic.</p>
<p>Also, a plug-in has been written to search YouTube for videos relating to your specified keywords in your post and article. </p>
<p>The script will be available to demo starting on December 1, 2009 and the code will be available immediately. </p>
<p>I look forward to seeing/ hearing from you in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://phppig.org/22/cj-affiliates-and-ebay-affiliates-prepare-for-a-new-set-of-free-tools/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using CJ API service with WordPress</title>
		<link>http://phppig.org/5/using-cj-api-service-with-wordpress/</link>
		<comments>http://phppig.org/5/using-cj-api-service-with-wordpress/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 20:14:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://phppig.org/?p=5</guid>
		<description><![CDATA[<p>Many affiliate marketers don&#8217;t know how easy the use of an API program is. I have been using the CJ API service for about two weeks and have noticed an increase in revenue because of it. Since I figured out how to put it to you in WordPress, I am going to share the code with <span style="color:#777"> . . . &#8594; Read More: <a href="http://phppig.org/5/using-cj-api-service-with-wordpress/">Using CJ API service with WordPress</a></span>]]></description>
			<content:encoded><![CDATA[<p>Many affiliate marketers don&#8217;t know how easy the use of an API program is. I have been using the CJ API service for about two weeks and have noticed an increase in revenue because of it. Since I figured out how to put it to you in WordPress, I am going to share the code with you. First, you need to download and install the EXEC-PHP plugin for wordpress. It can be downloaded here: <a href="http://bluesome.net/post/2005/08/18/50/" target="_blank">http://bluesome.net/post/2005/08/18/50/</a>.</p>
<p>Next you will need a couple of bits of information from CJ. First, if you haven&#8217;t signed up for the CJ API service, you can sign up here: <a href="http://webservices.cj.com/" target="_blank">http://webservices.cj.com/</a>. For the code to work, you will need you API number and the advertiser id. If you haven&#8217;t signed up for an advertiser that has a product catalog, now would be the time to do so.</p>
<p>Finally you will need to download the <a href="http://phppig.org/nusoap.zip" target="_blank">Nusoap library</a> by clicking the link. Unzip it and ftp into your sites root directory.</p>
<p>Once you have an advertiser that has a product catalog, you need to click on the advertiser details and look at the url. In Firefox, you are not able to edit the url but rather only view it. The url will look like this: https://members.cj.com/member/1234567890/accounts/publisher/getadvertiserdetail.do?ispopup=true&amp;<strong><span style="text-decoration: underline;">advertiserId=123456.<br />
</span></strong>I have highlighted the area by making the advertiser id bold and underlined. You will need to copy the number only and paste it into wordpad or some other text editor for now. You will also need to go to your account settings in CJ by clicking account. Click website settings and choose the site from the list of sites that you have entered that you will be making your post on. Once you get in here, copy the PID number and paste it in the same text editor file that you have saved the advertiser id on. Save the file for future reference.</p>
<p>Once you get your API number, you are ready to go.</p>
<p>Whenever you get the EXEC-PHP plugin installed into WordPress, you will now need to edit the header of your theme. You can do this by clicking Appearance &#8211;&gt;Editor. On the right hand side of the screen, you will see header. Click it. At the bottom of the code, you will need to add this snippet of code:<br />
<code>&lt;?php<br />
/*CJ API FOR WORDPRESS<br />
COPYRIGHT (C) 2009<br />
SCOTT P DAUGHERTY<br />
*/<br />
include("nusoap/lib/nusoap.php");</code><br />
<code>?></code></p>
<p>Save the header file with this code in it. Now you will be able to add the rest of the CJ API code on each individual post just as you would the twp-auction code for ebay. Now you are ready for your API id number and advertiser id. At the end of the post that you want the cj ads on, you will insert this code:</p>
<p><code>&lt;?php<br />
/*<br />
CJ API SEARCH AND RETURN<br />
PHPPIG<br />
COPYRIGHT (C)2009<br />
SCOTT P DAUGHERTY<br />
*/<br />
//Define user information<br />
$developerkey ="Your API key here";<br />
$websiteIdx ="Your website id here";<br />
$cjword = "Your keyword here";<br />
$advertiserIds = "Your advertiser id here";<br />
$serviceableArea = "";<br />
$upcOrIsbnOrEan = "";<br />
$manufacturerName = "";<br />
$advertiserSku = "";<br />
$lowPrice = "";<br />
$highPrice = "";<br />
$currency = "";<br />
$sortBy = "";<br />
$orderIn = "";<br />
$startAt = 0;<br />
$maxResultsx = 15;<br />
$soapclient = new nusoap_client("https://product.api.cj.com/wsdl/literal_wrapped/productSearchService.wsdl", true);<br />
$params = array(<br />
"developerKey" =&gt; $developerkey,<br />
"websiteId" =&gt; $websiteIdx,<br />
"advertiserIds" =&gt; $advertiserIds,<br />
"keywords" =&gt; $cjword,<br />
"serviceableArea" =&gt; "",<br />
"upcOrIsbnOrEan" =&gt; "",<br />
"manufacturerName" =&gt; "",<br />
"advertiserSku" =&gt; "",<br />
"lowPrice" =&gt; "",<br />
"highPrice" =&gt; "",<br />
"currency" =&gt; "",<br />
"sortBy" =&gt; "",<br />
"orderIn" =&gt; "",<br />
"startAt" =&gt; $startAt,<br />
"maxResults" =&gt; $maxResultsx<br />
);<br />
$proxy = $soapclient-&gt;getProxy();<br />
$result = $proxy-&gt;search($params);<br />
$count = $result['searchReturn']['count'];<br />
if($count &gt; 0) {<br />
for($i = 0; $i &lt; $count; $i++) {<br />
$advertiser_id  = $result['searchReturn']['products']['products'][$i]['advertiserId'];<br />
$advertiser_name = $result['searchReturn']['products']['products'][$i]['advertiserName'];<br />
$click_url = $result['searchReturn']['products']['products'][$i]['clickUrl'];<br />
$currency = $result['searchReturn']['products']['products'][$i]['currency'];<br />
$description = $result['searchReturn']['products']['products'][$i]['description'];<br />
$image_url = $result['searchReturn']['products']['products'][$i]['imageUrl'];<br />
$name = $result['searchReturn']['products']['products'][$i]['name'];<br />
$price = $result['searchReturn']['products']['products'][$i]['price'];<br />
$sku = $result['searchReturn']['products']['products'][$i]['sku'];<br />
$upc = $result['searchReturn']['products']['products'][$i]['upc'];<br />
echo "&lt;table border='0'&gt;&lt;tr&gt;&lt;td&gt;&lt;a href='$click_url' title='$name'&gt;&lt;font size='3'&gt;$name";<br />
echo "&lt;/font&gt;&lt;/a&gt;&lt;br&gt;&lt;font size='2'&gt;&lt;b&gt;$ $price &lt;/font&gt;&lt;/b&gt;";<br />
echo "&lt;br&gt;SKU: $sku";<br />
echo "&lt;br&gt;&lt;a href='$click_url'&gt;&lt;img src='$image_url'  title='$name'&gt;&lt;/a&gt;";<br />
echo "&lt;br&gt;&lt;font color='#000000'&gt;$description&lt;/font&gt;";<br />
echo " &lt;br&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;hr size='1'&gt;";<br />
}}<br />
?&gt;</code></p>
<p>At the top of the code, you will see the following:</p>
<p><code>$developerkey ="Your API key here";<br />
$websiteIdx ="Your website id here";<br />
$cjword = "Your keyword here";<br />
$advertiserIds = "Your advertiser id here";</code></p>
<p>Enter the information in on the appropriate lines and insert complete code into your post. It will return the results from the advertiser that you choose with your affiliate id. For an example, visit my site at <a href="http://scottpdaugherty.com/2009/11/15/choosing-a-guitar-for-a-christmas-present/">http://scottpdaugherty.com</a> to review the code in use.</p>
<input id="gwProxy" type="hidden" />
<input id="jsProxy" onclick="jsCall();" type="hidden" />
<input id="gwProxy" type="hidden" />
<input id="jsProxy" onclick="jsCall();" type="hidden" />
<input id="gwProxy" type="hidden" />
<input id="jsProxy" onclick="jsCall();" type="hidden" />
<input id="gwProxy" type="hidden" />
<input id="jsProxy" onclick="jsCall();" type="hidden" />
<input id="gwProxy" type="hidden" />
<input id="jsProxy" onclick="jsCall();" type="hidden" />
]]></content:encoded>
			<wfw:commentRss>http://phppig.org/5/using-cj-api-service-with-wordpress/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.240 seconds -->

