Category Archives: Social Networking

Search Engine Spider and User Agent Identification with “Ultimate User Agent Blacklist”

Search Engine Spider and User Agent Identification with “Ultimate User Agent Blacklist”

 

A user-agent is software (a software agent) that is acting on behalf of a user.
In many cases, a user-agent acts as a client in a network protocol used in communications within a client–server distributed computing system.

 

For more information view wiki
http://en.wikipedia.org/wiki/User_agent

 

Automated Agents is called as Bots.
http://user-agents.org has a complete list of all latest spiders/bots/user agents.
There are some more and those are anonymous (not known and have very different names).

 

If you develop a website and want to make the site accessible by some specific user agent or bots of a country, then you can update the information in your root .htaccess file.

 

As, Bot blocking blacklists are useless in some way as some rogue spiders just generate random user-agent strings so we will never have them in our list to start with, but We have tried list out as much as we can in the below zip file.

 

Ultimate User Agent Blacklist

 

What you have to done is, unzip the file and paste the code in your root .htaccess file, it will protect your website from unwanted crawling/indexing by anonymous bots.

 

If your website uses WordPress open-source, then can also use “Better WP Security” plug-in.
Just need to download and install the plug-in and go to “Better WP Security – Ban Users” Tab and enable “Enable Default Banned List”, you can also update the list according to your needs.

 

But please be careful before doing same, as it may affect your website’s core files and plug-in, So before doing this backup your website’s files and database.

 

Create Custom Google +1 Button

Social network by internet giant is “Google+” getting popular exponentially and of course they already have a huge customer database and all they have to do is to promote this new product among them.However people know the fact that Google+ is very special kind of social network with very unique features.

 

In parallel to Google+ they introduced +1 buttons for web masters.However the design of +1 button is non alterable and doesn’t go with most of the common web templates.If you already have +1 button, when you take your mouse over, it will pop up sharing window which is user unfriendly 🙁

 

You can also create Google +1 and share button with your own icon by follow some very simple steps:

 

First step you need a suitable icon/image for Google+ share button.Find it and edit in the way you want.

Then you have to prepare Google+ share URL.

 

https://plus.google.com/share?url=YOUR URL (Replace ‘YOUR URL’ with actual page URL)

 

If you are using wordpress blog, you can use below code.
https://plus.google.com/share?url=<?php the_permalink(); ?>

 

If you want a pop up window use the below code.

<a href="javascript:void(0);" onclick="popUp=window.open('https://plus.google.com/share?url=<span style="color: #ff0000;"><?php</span> the_permalink(); <span style="color: #ff0000;">?></span>','popupwindow','scrollbars=yes,width=800,height=400');popUp.focus();return false">Share on Gogole+</a>

You can also update the link  with an image icon with below code.

<a href="https://plus.google.com/share?url=<?php the_permalink(); ?>"><img src="your-custom-google-plus-icon/path/gplus.jpg" alt="Google+" title="Google+" /></a>

Share your WordPress page URL on social networking website by using a simple function

Share your WordPress post on facebook & other social networking website.

 

If you want to share your WordPress page URL on social networking website, it’s very simple to do.

Just place this function in your functions.php file, and call the function where do you want it to show.

 

<?php

function GetShareLinks() {
 
/* Your current page URL */
 $URI = get_permalink();
 
/* The js script used for goolge plus share button */
 $sharestring ='<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>';
 
$sharestring .='<a href="https://pinterest.com/scriptarticle/" target="_blank"><img width="16" height="16" alt="Follow Me on Pinterest" src="http://passets-lt.pinterest.com/images/about/buttons/small-p-button.png"></a>
 <a href="http://www.facebook.com/sharer.php?u='.$URI.'"><img src="'.get_bloginfo('template_url').'/images/facebook.jpg" alt="" /></a>
 <a href="http://twitter.com/intent/tweet?text='.$URI.'"><img src="'.get_bloginfo('template_url').'/images/twitter.jpg" alt="" /></a>
 <a href="http://www.linkedin.com/shareArticle?mini=true&url='.$URI.'"><img src="'.get_bloginfo('template_url').'/images/in.jpg" alt="" /></a>
 <g:plusone count="false" size="small"></g:plusone>';
 
return $sharestring;
 
}

?>

 

You can also use this function in other website (non WordPress) site, you have to just replace the get_permalink() function by current page URL and update the social icons images path.

 

If you face any issue to use this, put your comment, I’ll help you 🙂

 

PHP script for getting latest Tweets of a user

There are so many different ways to get tweets to display on your blog or web page, unfortunately most of these use JavaScript which means that the tweets displayed are not made available to search engines 🙁

 

Don’t worry; you can also display your latest Twitter tweets using PHP. You can achieve by following very simple functions.

 

function getLastestTweets fetches latest tweets

It require 2 parameters
$userid = User Id of the twitter account
$x         = number of tweets to be fetched

<?php

function getLastestTweets($userid,$x){
$url = "http://twitter.com/statuses/user_timeline/$userid.xml?count=$x&quot";
$xml = simplexml_load_file($url) or die('could not connect');
echo '<ul>';
foreach($xml->status as $status){
$text = twitterify( $status->text );
echo '<li>'.utf8_decode($text).'</li>';

$time = dateDiffForTweet(date("Y-m-d H:i:s"),date("Y-m-d H:i:s",strtotime($status->created_at)));
if(!sizeof($time)){ $time[0]= '1 second'; }
echo " ".$time[0]." ago";
}
echo '</ul>';
}

?>

function twitterify automatically converts hashtags (like #scriptarticle) to tag links, @links to author links (like @mahesh), and autolinks URIs (like http://scriptarticle.com ) to links.

<?php

function twitterify($ret) {
$ret = preg_replace("#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" >\\2</a>", $ret);
$ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" >\\2</a>", $ret);
$ret = preg_replace("/@(\w+)/", "<a href=\"http://www.twitter.com/\\1\" >@\\1</a>", $ret);
$ret = preg_replace("/#(\w+)/", "<a href=\"http://search.twitter.com/search?q=\\1\" >#\\1</a>", $ret);
return $ret;
}

?>

function dateDiffForTweet is used for showing time difference between tweet posted and current, like 2 mins ago,2 days ago

<?php

function dateDiffForTweet($time1, $time2, $precision = 6) {
// If not numeric then convert texts to unix timestamps
if (!is_int($time1)) {
$time1 = strtotime($time1);
}
if (!is_int($time2)) {
$time2 = strtotime($time2);
}

// If time1 is bigger than time2
// Then swap time1 and time2
if ($time1 > $time2) {
$ttime = $time1;
$time1 = $time2;
$time2 = $ttime;
}

// Set up intervals and diffs arrays
$intervals = array('year','month','day','hour','minute','second');
$diffs = array();

// Loop thru all intervals
foreach ($intervals as $interval) {
// Set default diff to 0
$diffs[$interval] = 0;
// Create temp time from time1 and interval
$ttime = strtotime("+1 " . $interval, $time1);
// Loop until temp time is smaller than time2
while ($time2 >= $ttime) {
$time1 = $ttime;
$diffs[$interval]++;
// Create new temp time from time1 and interval
$ttime = strtotime("+1 " . $interval, $time1);
}
}

$count = 0;
$times = array();
// Loop thru all diffs
foreach ($diffs as $interval => $value) {
// Break if we have needed precission
if ($count >= $precision) {
break;
}
// Add value and interval
// if value is bigger than 0
if ($value > 0) {
// Add s if value is not 1
if ($value != 1) {
$interval .= "s";
}
// Add value and interval to times array
$times[] = $value . " " . $interval;
$count++;
}
}

return $times;
// Return string with times
//return $times;
// return implode(", ", $times);
}

?>

Here is the way; you can display your tweets

<?php

//my userid scriptarticle
getLastestTweets('scriptarticle',5);

?>

If you face any issue to implement the code just left a comments below the post.

Integrate Twitter Widget to add to your website

The twitter updates are always short – under 140 characters each. Plus, one can post updates and follow her friends using the Twitter website, software on his browser, a mobile phone or instant messages. People aren’t tied to one device. This makes the twitter so popular.

 

It has grown far beyond its microblogging roots to become a fabulous tool for social messaging.

Many people use Twitter clients to update their status and read tweets, but there are also a host of useful Twitter widgets that allow you to check your tweets from your blog/website or even let people re-tweet your blog entries.

 

Display your Twitter updates on your website like this.

twitter-widget

This is one of Twitter widgets that will let you take your status updates and put them up anywhere that allows custom widgets. The great thing about the Twitter Profile Widget is that you can put your tweets on a loop.

 

Twitter provide very rich widgets, where you can easily manage it’s width, height, background colour, text colour, links, number of tweets, loop scroll etc.

 

You can produce the code by follow the below link
https://twitter.com/about/resources/widgets/widget_profile

 

SEO Tips to Improve Your Website’s Google Ranking & Website Traffic

Boost your website in major search engines by following some SEO tips as below:

 

1) Website content is the most important for SEO.Good, well-written (spelling and grammatically) and unique with quality content that contain your primary keyword and phrases always hike your site ranking.But Search engine prefer natural language content 🙂 Don’t try to mix so much your text with keywords.

 

2) Create a network of quality back-links using your keyword phrase as the link i.e. if your target is ‘Scriptarticle’ then link to’scriptarticle’ instead of ‘Click here’ link.Not only should your links use keyword anchor text, but the text (description text) around the links should also be related to your keywords.

 

3) You must have a unique, keyword focused Title tag (h1) on every page of your site.If optimizing blog posts; optimize your post title independently from your blog title.Focus on search phrases, not single keywords, and put your location in your text (‘Our Jaipur Centre’ not only ‘Our Centre’) to help you get found in local search.

 

4) When link building, think quality, not quantity. One single, good and authoritative link can do a lot more for your site than a dozen poor quality links.Links from a high Page Rank site are good as high PR indicates high trust, so the back links will carry more weight age.

 

5) Give each page a focus on a single keyword phrase. Don’t try to optimize the page for several keywords at once.

 

6) Check for canonical issue i.e. and non-www domains. Decide which you want to use and 301 redirect the other to it. In other words, if http://www.yourdomain.com you prefer, then http://yourdomain.com should redirect to it.

 

7) Frames, Flash and AJAX all share a common problem – you can’t link to a single page. Spiders or Crawlers can crawl text, not Flash and images. Don’t use Frames at all and use Flash and AJAX as less as you can for best SEO results.

 

8) If you want a new website to be spidered, submitting through Google’s regular submission can take many days. The quickest and easiest way to get your site crawled is by getting a link to it through another quality site.

 

9) SEO doesn’t matter if you have a weak or non-existent/dead call (href) to action. Be sure your call (href) to action is clear and present.

 

10) Optimize the text in your RSS feeds just like you should with your posts and web pages. Use descriptive, keyword rich text in your title and description.

 

11) Use captions and alt tag with your images. As with newspaper photos, place keyword rich captions with your images. A lot of searches is for a keyword plus one of those words.

 

12) Good global navigation and linking and paging will serve you much better than relying only on an XML Sitemap.

 

13) During link purchase or exchange, check the cache date of the page where your link will be located in Google.Search for ‘cache:URL’ where you substitute ‘URL’ for the actual page. If the page isn’t there or the cache date is more than an month old, the page isn’t worth much.

 

14) You must be sure that your URLs reports of server headers have ‘200 OK’ status or ‘301 Moved permanently’. If the status shows anything else, check to be sure your URLs are set up properly. You can find online tool for checking server header.

 

15) Social marketing is a part of SEO.As more you understand about sites like Twitter, Facebook, LinkedIn, Digg, etc, the better you will be able to compete in search.

 

16) Some of your most links has not appeared in web sites at all but be those in the form of e-mail communications such as newsletters.

 

17) Add all components to your Blog website like reviews, sharing functions, ratings, images, visitor comments, photo gallery etc.