Dynamically Generating Webpages – Insert Video

This is just a teaser for a series of articles on dynamically creating webpages on the fly based on keywords. Whether it’s based on a list of related keywords to your target set or simply based on what a user is searching for, the more content that you can provide related to the term, the better off your chances of it being ranked well in the serps (not to mention will provide a better user experience).

Here’s an easy one for you, it will pull a youtube video based on whatever keyword you give it. For use in a wordpress installation, make sure to enable the Exec-PHP plugin before inserting the code.

There are two parts to this, the youtube class and then the actual code to call it and display the video. This was taken long ago from a post on WF, though has been slightly modded. I forget who originally provided it but thanks. 🙂

Instead of having one huge php file with all the various functions, I’ve found it easier to separate each task into separate class files, that way on the actual page I only need to use the include() function and call up the script using my keyword.

Create a file called youtube_class.php and insert the following code:

<?php 

class youtube{ 
     
    function get_youtubevideo($theproduct){                 
        ///do youtube stuff     
        $theproductencoded=urlencode($theproduct);         
        $apicall = "http://gdata.youtube.com/feeds/videos?vq=$theproductencoded&max-results=1";         
        //Initialize the Curl session 
        $ch = curl_init();         
        //Set curl to return the data instead of printing it to the browser. 
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);         
        //Set the URL 
        curl_setopt($ch, CURLOPT_URL, $apicall);         
        //Execute the fetch 
        $data = curl_exec($ch);         
        //Close the connection 
        curl_close($ch);                             
        $xml = new SimpleXMLElement($data);                     
        // Check to see if the XML response was loaded, else print an error 
        $contentcenter.="<div class="leftside">";         
        //show the video if a video was found         
        if (!empty($xml->entry)) {             
        $media = $xml->entry->children('http://search.yahoo.com/mrss/');         
        $vidtitle= $media->group->title;         
        $vid= $media->group->content->attributes()->url;             
        $contentcenter.="<h1>Video for " . str_replace("-"," ",ucwords($theproduct)). "</h1>";                     
        $results = '';         
        // If the XML response was loaded, parse it and build links          
        $vid = str_replace("?v=", "v/", $vid);          
        // For each SearchResultItem node, build a link and append it to $results         
        $contentcenter.= "<object width="425" height="355"> 
        <param name="movie" value="$vid"></param> 
        <param name="wmode" value="transparent"></param> 
        <embed src="$vid" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed> 
        </object>";         
        } 
         
        // If there was no XML response, print an error         
        else {             
            //$results = "Dang! Must not have got the XML response!"; 
            $contentcenter .= "<h2>Error: No video found</h2>";                     
        } 
        $contentcenter.="</div>";         
        return $contentcenter;         
    }     
}


?>

Now on whatever page you’d like to display the youtube video, simply insert the following code:

include_once("youtube_class.php");
$theproduct = 'topic';
$videoshow = new youtube();
echo $videoshow->get_youtubevideo($theproduct);

Typically you’ll have the keyword that you’re using to generate the dynamic page already stored as a variable, in which case you can just replace $theproduct = ‘topic’; with your variable(i.e. $searchkeyword).

Cloak And Rotate Your Affiliate Links!

Here’s a simple php script that you can use to not only cloak the referrer information, but also to rotate through your affiliate links so that you can test different offers and/or different advertising networks.

In order to hide your traffic sources you need to send the user through a double-redirect before pushing them along to the advertisers page. This can be done many different ways, but for the sake of this post I’m just going to use a very basic PHP redirect. For this setup, have the offer link on your landing page point to link.php, which will immediately redirect them to offer.php. Once they reach offer.php it will randomly select one of the affiliate links and redirect them on to their final destination. It’s that simple.

link.php

<?php
/* Redirect browser */
header("Location: offer.php");
/* Now the next line just makes sure that code below does not get executed when we redirect. */
exit;
?>

Now here’s the second file – You’ll want to replace the URL’s with YOUR affiliate links. If you’d like to add or remove offers just add or remove one of the “$affiliateoffer[] = ‘http://www.yourdomain.com/tracking202/redirect/dl.php?t202id=1788&t202kw='” lines.

offer.php

<?php
$r = $_GET['sub'];
$affiliateoffer[] = 'http://www.yourdomain.com/tracking202/redirect/dl.php?t202id=1788&t202kw=';
$affiliateoffer[] = 'http://www.yourdomain.com/tracking202/redirect/dl.php?t202id=2788&t202kw=';
$affiliateoffer[] = 'http://www.yourdomain.com/tracking202/redirect/dl.php?t202id=3788&t202kw=';
$affiliateoffer[] = 'http://www.yourdomain.com/tracking202/redirect/dl.php?t202id=4788&t202kw=';
$affiliateoffer[] = 'http://www.yourdomain.com/tracking202/redirect/dl.php?t202id=5788&t202kw=';
srand ((double) microtime() * 1000000);
$random_number = rand(0,count($affiliateoffer)-1);
$dur = ($affiliateoffer[$random_number]);
$moneysite = $dur.$r;
header("Location: $moneysite");
?>

There you go, now you’re safeguarding your leads as well as testing out networks/offers. Remember, the secret to having sustainable campaigns is to always be testing!

Free PHP Source Code: A/B Split Testing For Your Landing Pages


As with any type of marketing, you should always be testing new ideas + strategies in every facet of your work. The most important and most typically overlooked form of testing that is essential to getting a profitable conversion rate is in testing your squeeze or landing pages. Switch everything up! The images, the copy, heck even the entire layout + domain. You’ll never know what will make you money/convert until you actually find it and the best way to setup your site to systematically rotate through different landing page variations is by A/B testing (or in this case you could actually take it from A-Z as far as different destinations for your users). It’s just a small little php script that you put at the top of any page you’re sending traffic to. After each new referral comes through it just goes down the list of pages (you can also use domains if you wanted to try out different URIs). It’s that simple + there’s very little chance anyone will even realize they’re being redirected. Enjoy!

<?php
   if (!empty($_SERVER['HTTP_REFERER'])) {
      $currentPage = $_SERVER['PHP_SELF'];
      echo '<meta http-equiv="refresh" content="0; url='. $currentPage .'">';
      return;
   }

   // HERE IS WHERE YOU PUT IN YOUR PAGES/DOMAINS TO TEST. FEEL FREE TO COPY AND PASTE MORE!
   $domains   = array();
   $domains[] = 'quietaffiliate.com';
   $domains[] = 'twitter.com/quietaffiliate';
   $domains[] = 'wickedfire.com';


   $ct = count($domains)-1;
   $currentDomain = $domains[rand(0, $ct)];

   header("Location: http://www.$currentDomain/", TRUE, 301);
?>

30 Free Tools For Analyzing Backlinks

backlinks-goldmine.jpg

Backlinks are an important part of any website’s SEO. How you can gauge where your competition is getting their links from as well as how you might be able to get them too is a critical part of the seo process. Here’s a list of 30 free backlink tools that will analyze a given website or domain and tell you who’s linking to them. Some of these tools take it a step further and will tell you the domain PR, the PR of the specific linking page, anchor tags and more!

Each of these is different so i’d suggest you try a few until you find one that works best for your own needs. Personally I don’t know what I would do without the Link Checker hosted by Australia-based SEOPro, but to each their own.

30 FREE Link Building Tools:

enjoy!

330 Social Bookmarking Sites To Get Backlinks

Here’s a giant list of updated social bookmarking sites that you can post your links on to get backlinks and improve your SERP. They’re listed in order by pagerank as of June ’09.

http://facebook.com 9
http://slashdot.org 9
http://technorati.com 9
http://del.icio.us 8
http://digg.com 8
http://mixx.com 8
http://propeller.com 8
http://reddit.com 8
http://stumbleupon.com 8
http://blinklist.com 7
http://folkd.com 7
http://foxiewire.com 7
http://google.com/bookmarks 7
http://mister-wong.com 7
http://newsvine.com 7
http://sphere.com 7
http://squidoo.com 7
http://wikio.com 7
http://bibsonomy.org 6
http://blogcatalog.com 6
http://diigo.com 6
http://dzone.com 6
http://faves.com 6
http://findnews.org 6
http://jumptags.com 6
http://kwoff.com 6
http://ma.gnolia.com 6
http://onlywire.com 6
http://pusha.se 6
http://scoopit.co.nz 6
http://simpy.com 6
http://sphinn.com 6
http://tipd.com 6
http://co.mments.com 5
http://designfloat.com 5
http://fcc.com 5
http://gabbr.com 5
http://givealink.org 5
http://haohaoreport.com 5
http://indianpad.com 5
http://joomocracy.com 5
http://kirtsy.com 5
http://linkagogo.com 5
http://linkarena.com 5
http://linkswarm.com 5
http://mobiseer.com 5
http://myhq.com 5
http://myjeeves.ask.com 5
http://mylinkvault.com 5
http://netvouz.com 5
http://plime.com 5
http://quadriot.com 5
(more…)

Free First-name and Last-name Databases (CSV and SQL)

free_first_and_lastname_database_csv

Matt over on the WF forums had recently posted a SQL database that he had created comprised of first and last names, a great resource to have handy when auto-generating identities, accounts, comment authors, etc.. While it was a pretty large list, it still wasn’t as complete as the one i’ve been using over the years (also it was separated by gender and used one giant table instead of segmenting the first and last names into two). I figured that if I was going to complain about something free, I might as well provide something in return, so here’s your chance to download a free first and last name database in both SQL and CSV formats (pick your poison). There are a total of 5494 first-names and 88799 last-names allowing for a never-ending source of randomly generated full names.

Free Name Database Download – SQL:
.sql File | .zip File

Free Name Database Download – CSV:
First Names (5494) – .csv File & Last Names (88799) – .csv File
I also compressed them both for easy download – .zip of both files

enjoy.

Break out of ANY iFrame (Including Google Image Search)

Have a video game portal and you’re tired of folks iframing their own ads around your games? Want to break the google image iframe when it reaches your site? Easy, just copy and paste this code at the top of your file and it’ll break you out of any iframe. For large sites it’s best to put it in an external .js file and just use an include call at the top of each page:

<script type="text/javascript">
	<!--
		if (top.location!= self.location) {
			top.location = self.location.href
		}
	//-->
</script>

Enjoy

A Complete List of XML-RPC PING Services

XML-RPC Ping Services

Alerting search engines that you’ve updated your website and would like to have their spiders re-crawl the domain can be accomplished by ‘pinging’ them with your URL. This feature is built-in to most popular blog and CMS platforms (like WordPress) and will automatically ping various networks anytime that you save or publish something new. Sometimes though it can be beneficial to ‘help’ this process along, especially if you’re creating a site from scratch and don’t have any sort of auto-ping functionality built-in.
Two websites that will ping a long list of services for you are Pingoat and Pingler. These are both great resources for any website developer.

I’m a big fan of Pingler in particular because it lets you modify the list of services that it will contact when you use it.

Now there are many blackhat, whitehat and well “greyhat” uses for pinging these services to let them know of a site update, all of which are hot-topics for debate (which I won’t get into just yet). Just a word of caution though – You can easily get de-indexed if you ping Google too often, as well as from a variety of other search engines…so with that said, you’ve been warned. Don’t abuse this service!

For those of you looking for a full list of URL’s that allow you to notify them of updates, i’ve provided such a list below. It also includes all the international URL’s for Google’s Blogsearch. Keep in mind a lot of these actually will ping multiple resources so if you use them all, you’ll be hitting a large number of duplicate services….just a heads up. Enjoy.

XML-RPC Ping Services

http://1470.net/api/ping
http://a2b.cc/setloc/bp.a2b
http://api.feedster.com/ping
http://api.moreover.com/RPC2
http://api.moreover.com/ping
http://api.mw.net.tw/RPC2
http://api.my.yahoo.com/RPC2
http://api.my.yahoo.com/rss/ping
http://bblog.com/ping.php
http://bitacoras.net/ping
http://blog.goo.ne.jp/XMLRPC
http://blog.with2.net/ping.php
http://blogbot.dk/io/xml-rpc.php
http://blogdb.jp/xmlrpc
http://blogdigger.com/RPC2
http://blogmatcher.com/u.php
http://blogoole.com/ping
http://blogoon.net/ping
http://blogpeople.net/servlet/weblogUpdates
http://blogsdominicanos.com/ping
http://blogsearch.google.ae/ping/RPC2
http://blogsearch.google.at/ping/RPC2
http://blogsearch.google.be/ping/RPC2
http://blogsearch.google.bg/ping/RPC2
http://blogsearch.google.ca/ping/RPC2
http://blogsearch.google.ch/ping/RPC2
http://blogsearch.google.cl/ping/RPC2
http://blogsearch.google.co.cr/ping/RPC2
http://blogsearch.google.co.hu/ping/RPC2
http://blogsearch.google.co.id/ping/RPC2
http://blogsearch.google.co.il/ping/RPC2
http://blogsearch.google.co.in/ping/RPC2
http://blogsearch.google.co.it/ping/RPC2
http://blogsearch.google.co.jp/ping/RPC2
http://blogsearch.google.co.ma/ping/RPC2
http://blogsearch.google.co.nz/ping/RPC2
http://blogsearch.google.co.th/ping/RPC2
http://blogsearch.google.co.uk/ping/RPC2
http://blogsearch.google.co.uk/pingRPC2
http://blogsearch.google.co.ve/ping/RPC2
http://blogsearch.google.co.za/ping/RPC2
http://blogsearch.google.com.ar/ping/RPC2
http://blogsearch.google.com.au/ping/RPC2
http://blogsearch.google.com.br/ping/RPC2
http://blogsearch.google.com.co/ping/RPC2
http://blogsearch.google.com.do/ping/RPC2
http://blogsearch.google.com.mx/ping/RPC2
http://blogsearch.google.com.my/ping/RPC2
http://blogsearch.google.com.pe/ping/RPC2
http://blogsearch.google.com.sa/ping/RPC2
http://blogsearch.google.com.sg/ping/RPC2
http://blogsearch.google.com.tr/ping/RPC2
http://blogsearch.google.com.tw/ping/RPC2
http://blogsearch.google.com.ua/ping/RPC2
http://blogsearch.google.com.uy/ping/RPC2
http://blogsearch.google.com.vn/ping/RPC2
http://blogsearch.google.com/ping/RPC2
http://blogsearch.google.de/ping/RPC2
http://blogsearch.google.es/ping/RPC2
http://blogsearch.google.fi/ping/RPC2
http://blogsearch.google.fr/ping/RPC2
http://blogsearch.google.gr/ping/RPC2
http://blogsearch.google.hr/ping/RPC2
http://blogsearch.google.ie/ping/RPC2
http://blogsearch.google.in/ping/RPC2
http://blogsearch.google.it/ping/RPC2
http://blogsearch.google.jp/ping/RPC2
http://blogsearch.google.lt/ping/RPC2
http://blogsearch.google.nl/ping/RPC2
http://blogsearch.google.pl/ping/RPC2
http://blogsearch.google.pt/ping/RPC2
http://blogsearch.google.ro/ping/RPC2
http://blogsearch.google.ru/ping/RPC2
http://blogsearch.google.se/ping/RPC2
http://blogsearch.google.sk/ping/RPC2
http://blogsearch.google.tw/ping/RPC2
http://blogsearch.google.us/ping/RPC2
http://blogshares.com/rpc.php
http://blogsnow.com/ping
http://blogstreet.com/xrbin/xmlrpc.cgi
http://bulkfeeds.net/rpc
http://catapings.com/ping.php
http://coreblog.org/ping/
http://effbot.org/rpc/ping.cgi
http://feedsky.com/api/RPC2
http://fgiasson.com/pings/ping.php
http://focuslook.com/ping
http://holycowdude.com/rpc/ping
http://imblogs.net/ping
http://j-ranking.com/ping.cgi
http://lasermemory.com/lsrpc
http://mod-pubsub.org/ping.php
http://newsisfree.com/RPCCloud
http://newsisfree.com/xmlrpctest.php
http://ping.amagle.com
http://ping.bitacoras.com
http://ping.blo.gs/
http://ping.blogg.de
http://ping.blogmura.jp/rpc/
http://ping.blogoon.net/
http://ping.blogs.yandex.ru/RPC2
http://ping.cocolog-nifty.com/xmlrpc
http://ping.exblog.jp/xmlrpc
http://ping.fakapster.com/rpc
http://ping.fc2.com/
http://ping.feedburner.com
http://ping.gpost.info/xmlrpc
http://ping.kutsulog.net/
http://ping.myblog.jp
http://ping.namaan.net/rpc
http://ping.rootblog.com/rpc.php
http://ping.speenee.com/xmlrpc
http://ping.syndic8.com/xmlrpc.php
http://ping.weblogalot.com/rpc.php
http://ping.weblogs.se
http://ping.wordblog.de
http://pinger.blogflux.com/rpc
http://pinger.onejavastreet.com
http://pingoat.com/goat/RPC2
http://pingqueue.com/rpc
http://queerfilter.com/ping
http://r.hatena.ne.jp/rpc
http://rcs.datashed.net/RPC2
http://rpc.blogbuzzmachine.com/RPC2
http://rpc.blogrolling.com/pinger/
http://rpc.britblog.com
http://rpc.icerocket.com:10080
http://rpc.newsgator.com
http://rpc.pingomatic.com/
http://rpc.reader.livedoor.com/ping
http://rpc.tailrank.com/feedburner/RPC2
http://rpc.technorati.com/rpc/ping
http://rpc.weblogs.com/RPC2
http://rpc.wpkeys.com
http://rssfeeds.com/suggest_wizzard.php
http://rssfwd.com/xmlrpc/api
http://serenebach.net/rep.cgi
http://services.newsgator.com/ngws/xmlrpcping.aspx
http://snipsnap.org/RPC2
http://thingamablog.sourceforge.net/ping.php
http://topicexchange.com/RPC2
http://trackback.bakeinu.jp/bakeping.php
http://wasalive.com/ping
http://weblogalot.com/ping
http://weblogues.com/RPC
http://xianguo.com/xmlrpc/ping.php
http://xmlrpc.blogg.de
http://xping.pubsub.com/ping/
http://zhuaxia.com/rpc/server.php
http://blogupdate.org/sverige/ping/
http://blo.gs/ping.php
http://blogping.unidatum.com/RPC2/
http://mod-pubsub.org/kn_apps/blogchatt
http://www.lasermemory.com/lsrpc/
http://ping.amagle.com/
http://ping.blogg.de/
http://ping.bloggers.jp/rpc/
http://ping.feeds.yahoo.com/RPC2/
http://pingoat.com/
http://pingqueue.com/rpc/
http://ping.weblogs.se/
http://rpc.britblog.com/
http://rcs.datashed.net/RPC2/
http://rpc.icerocket.com:10080/
http://rpc.newsgator.com/
http://rpc.pingomatic.com
http://rpc.wpkeys.com/
http://zing.zingfast.com