| Subcribe via RSS

Join the Black Hat Digest Newsletter

Get On The Site Creation Waiting List
Have a new website delivered to you every month! Read more...

Convert Url to Tiny Url

December 22nd, 2009 | No Comments | Posted in Tutorials

Sometimes you need to convert a url to a new one on the fly.  Tinyurl offers a very easy to use API to do that.  You can do it complicated with curl or you can just use file_get_contents and make it a one line function.

function ShortURL($ToConvert) {
$short_url= file_get_contents(“http://tinyurl.com/api-create.php?url=” . $ToConvert);
return $short_url;

}

Just call it with:

$newurl = ShortURL(‘http://www.linktoshorten.com/itsreallylong’);

Cash in on your Competitors’ Work – SpyFu Ad History

Popularity: 1% [?]

Slamming into Twitter – it’s fun!

December 19th, 2009 | No Comments | Posted in Online Tools, Rambling

Well it’s snowing like crazy here and since my monster truck is in the shop I don’t think we will be going anywhere today.  Something about the two foot high drift into the side of the Mini-Van suggests that I should just sit tight today.  Yesterday I ported my twitter slamming script into a script anyone can use and I’m wondering what else you kids would like to see.

The twitter script takes as many twitter accounts, and rss feeds as you want to shove at it and posts at your schedule.  It works for traffic – even if the twitter accounts aren’t really popular.

YOU CAN MAKE THEM POPULAR THOUGH.

I added in the ability for you to add tweets that have nothing to do with your rss feeds and made it gender specific so you can have women tweet girl crap and men be men :)   (Did you see what I did there?)

Anyway, I expect to be snowed in today and tomorrow (first real snow here in years) – so if you have any bright ideas let me know and I just might make it.

Cash in on your Competitors’ Work – SpyFu Ad History

Popularity: 2% [?]

Tags: ,

Random RSS Item with PHP and ICONV for formatting.

December 19th, 2009 | 4 Comments | Posted in Tutorials

So I had to hack together a little snippet today that would return just one single item from a rss feed and have it be random from the available items.

(For example this snippet of code will return one random rss item from blackhatdigest – skipping the most recent entry)

function load_xml_feed($location)
{
global $value1;
$feedXml = simplexml_load_file($location);

$i= ‘1′;
foreach ($feedXml->channel->item as $article)
{
$title[$i] = (string)$article->title;
$link[$i] = (string)$article->link;
$description[$i] = (string)$article->description;

$i++;

}
$randnumber = rand(2, $i);
$link = trim($link[$randnumber]);
$title = trim($title[$randnumber]);
$description = trim($description[$randnumber]);
$title = iconv(“UTF-8″, “ISO-8859-1″, $title);
$description = iconv(“UTF-8″, “ISO-8859-1″, $description);
$value1 = array($title,$link,$description);
return $value1;
}

$rss = ‘http://feeds.feedburner.com/BlackHatSeoDigest’;
load_xml_feed($rss);
$link = $value1[1];
$title = $value1[0];
$description = $value1[2];

echo $link;
echo $title;
echo $description;

Cash in on your Competitors’ Work – SpyFu Ad History

Popularity: 2% [?]

Tags: , ,