HM2K http://hm2k.org/ Research and development Tue, 15 May 2012 23:17:55 +0000 en-GB hourly 1 https://wordpress.org/?v=5.5.1 181873647 Unable to update nameservers: Nameserver doesn’t exist at the registry https://hm2k.org/posts/unable-to-update-nameservers-nameserver-doesnt-exist-at-the-registry https://hm2k.org/posts/unable-to-update-nameservers-nameserver-doesnt-exist-at-the-registry#comments Sun, 06 May 2012 16:28:24 +0000 http://labs.phurix.net/?p=3349 Related posts:
  1. PHP OpenSRS Client This is only a quick message to say that I...
  2. Transfering domains from Godaddy.com to TuCows OpenSRS I need to transfer a bunch of domains from Godaddy...
  3. HP Software Update Today, I am trying to install a “HP Scanjet 7650n”,...
  4. Domain Slamming Ever received one of those domain renewal notices from companies...
]]>
If you have domains with TuCows OpenSRS you may be faced with this error when you try and set custom name servers on your domain through the OpenSRS manage interface:

Unable to update nameservers: Nameserver [ns2.example.co.uk] doesn’t exist at the registry.

Especially if you’ve recently set a new glue up.

In the OpenSRS domain manager it says:

** IMPORTANT: Before adding additional name servers to your configuration, you should be sure that the name server has setup correctly. 24 – 48 hours after you submit a request for an additional name server, it will be in the rotation for authoritative lookups and if it is not setup correctly, your site will take a long time to resolve when visitors try to find you.

You can ignore this for now, here’s what you need to do first…

You, or your admin who has access to the OpenSRS reseller interface needs to find the page in there entitled “Add Nameserver to All Foreign Registries” as per these instructions:

Add Nameserver to All Foreign Registries
This interface allows you to add Registered Nameservers to all of the Registries to which the OpenSRS system is connected. If you want to use a COM/NET/ORG nameserver (default.opensrs.net) on a .BIZ domain, you have to first add it to the “foreign” .BIZ Registry using this option. The reason for this is because each Registry keeps a database of “registered nameservers”, and new nameservers at “foreign” registries need to be explicitly added before they can be used to resolve domains in that TLD. Use this interface when you get the error “Unable to add nameservers: Command failed: unable to verify existence of nameserver” when trying to add a foreign nameserver to a domain.

To add a nameserver to all foreign registries

  1. In the Domain Management section of the RWI, click Add Nameserver to All Foreign Registries.
  2. In the Nameserver text box, enter the nameserver.
  3. Click Add Nameserver.

Once you do that you should see a message that says:

.com registry: Successfully added
.asia registry: Successfully added
.xxx registry: Successfully added
.com.au registry: Successfully added
.biz registry: Successfully added
.bz registry: Successfully added
.ca registry: Successfully added
.cc registry: Successfully added
.com.cn registry: Successfully added
.co registry: Successfully added
.in registry: Successfully added
.info registry: Successfully added
.es registry: Successfully added
.me registry: Successfully added
.mobi registry: Successfully added
.name registry: Successfully added
.nl registry: Successfully added
.org registry: Successfully added
.tv registry: Successfully added
.us registry: Successfully added
.ws registry: Successfully added
.pro registry: Successfully added

Or similar.

Now we give it 24-48 hours, then you can set custom name servers on your domain via the OpenSRS manage interface.

]]>
https://hm2k.org/posts/unable-to-update-nameservers-nameserver-doesnt-exist-at-the-registry/feed 1 3349
Anti Email Spam in the UK https://hm2k.org/posts/anti-email-spam-in-the-uk https://hm2k.org/posts/anti-email-spam-in-the-uk#respond Fri, 23 Mar 2012 15:23:22 +0000 http://www.hm2k.com/?p=51 Related posts:
  1. Over sixteen ways to obfuscate e-mail addresses Back in 2007 I wrote about email addresses on your...
  2. email address on your website This is something that people don’t seem to realise, and...
  3. Fax to email Fax to email is perhaps one of the most interesting,...
  4. Start your own free email service I have been interested in starting my own free email...
]]>
Many years back I began investigating anti email spam in the UK as a way to defend against the amount amount of email spam we were receiving to certain email addresses.

The reason this email address was getting so much spam is because it was harvested by a website spider bot, as the email address was placed on company website by the previous webmaster.

DO NOT put your email address or any email addresses directly on your website, instead use a form.

Back then there was only examples of support for US, but very little support in the UK.

One thing I did find was the Office Of Fair Trading Spam Tips but they were not very useful, the JunkBusters.com website has some nice tips on “junk email“, if only something existed like this for the UK.

I discovered that in the US you can send your junk/spam email to [email protected] and they will pursue law enforcement actions against people sending the emails.

After I read the NEW RULES ON EMAIL MARKETING article, I figured I could issue a complaint with the Information Commissioner via this form.

Update: In 2010 the BBC offered an article entitled: “How can I stop getting spam emails?” which seems to offer sufficient advice, there’s also a whole heap of resources in the Dmoz “email spam” directory.

]]>
https://hm2k.org/posts/anti-email-spam-in-the-uk/feed 0 51
Migrating IMAP mailboxes to a cPanel server https://hm2k.org/posts/migrating-imap-mailboxes-to-a-cpanel-server https://hm2k.org/posts/migrating-imap-mailboxes-to-a-cpanel-server#comments Mon, 07 Nov 2011 23:02:22 +0000 http://labs.phurix.net/?p=3322 Related posts:
  1. The requested URL /cpanel was not found on this server If you run cPanel servers, then you may at some...
  2. Installing Subversion on a cPanel Server It should be easy right? Just “yum install subversion”. Nope. You...
  3. How to find the fastest CVSUP mirror server Some time ago I wrote about using fastest_cvsup, to find...
  4. Installing IonCube Loader with cPanel on CentOS There seems to be limited details of how this is...
]]>
A customer got in touch with us and explained their situation.

They need to setup their email on the go and configure some forwarders. Their issue was that they were never given access to the control panel by the account holder and have since lost touch.

This unfortunately left them in a situation where they had no control over their hosting, they asked me to help them out.

My task was to migrate their existing IMAP mailboxes to their hosting account on one of our cPanel servers…

The first thing I did was get their UK domain onto our TAG giving us control over that for a small cost of £10+VAT, which the customer was only happy to pay.

There are other ways to get control of the domain without the cost, such as dealing with the host directly but in this case, fasthosts refuses to communicate with you unless you’re a customer. Ridiculous.

From here on inward, you’ll need root access to cPanel WHM on your server, or know someone who has.

At this point you need to start to create your mailboxes on the new server that match up to the existing ones.

The only issue with this is that you may find you can’t add “Remote Domains” (domains hosted elsewhere).

This item lets you allow cPanel users to create parked and addon domains that resolve to other servers. To make your selection, click the button corresponding to the option you wish to use. This value defaults to Off.

Warning: Enabling this option can cause major security issues. We strongly recommend that you do not enable this option.

You’ll need to “Allow Remote Domains” (Under “Tweak Settings” in WHM) so you’re able to add the domain. Once added, you can turn it off again.

As I said, once the domain is added you can create your mailboxes in cPanel to match what you already have.

I then went ahead and added them to the customer’s email client (Outlook 2007) to make sure everything was working as expected (it was).

They should have two sets of accounts added for each email address, the only difference between them should be the servers they use.

Migrating

This is where the fun starts.

If you’ve tried moving messages before in Outlook you’ll know it’s pretty slow. The issue is that, you’re downloading the message from the existing server, copying it to your computer, then uploading it to the other server.

This is a slow process, especially if you’re on regular UK broadband. In addition to that, you’ll find that Outlook will lock up while it waits for the server to respond.

I tested moving a few thousand messages: it took 8 hours. At this rate it would take around a week to do all of the accounts which isn’t feasible in a live environment.

Thunderbird isn’t much better. There had to be a better solution…

I got in touch with cPanel, as they have a dedicated “migration” team, however they were asking for shell, ftp or control panel access, none of which the customer had.

At first I had considered a server side, IMAP compatible email client such as Mutt or PINE, but I felt this may be a bit cumbersome.

Enter imapsync…

imapsync

After a quick search I came across imapsync which appears to be the solution I was looking for.

It’s written in Perl and is open source so there’s no reason it shouldn’t run on a CentOS server.

To install imapsync on CentOS (with cPanel) you’ll need to do the following:

First of all, imapsync isn’t in any of the official CentOS repositories so you need to install the RPMForge repository.

So, for example, on a CentOS 4 i386 install I would do:

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el4.rf.i386.rpm

rpm -i rpmforge-release-0.5.2-2.el4.rf.i386.rpm

Now it’s installed, you can utilise it by using yum combined with “–enablerepo=rpmforge” to install imapsync.

However, before you go ahead and do that, you need to realise that because cPanel has it’s own set of perl modules and blocks the OS ones, you need to disable the “exclude” line in the yum configuration file.

nano -w /etc/yum.conf

Note: Use whatever editor you prefer, I’m using nano. The -w is for no word wrap as this file contains long lines.

In this file, you need to comment out the following like:

#exclude=apache* bind-chroot courier* dovecot* exim* filesystem httpd* mod_ssl* mysql* nsd* perl* php* pr$

The hash (#) at the beginning means it’ll no longer be parsed, so nothing is excluded.

Now you can go ahead and install imapsync trouble free:

yum install imapsync –enablerepo=rpmforge

This should install imapsync and any dependencies (such as the required perl modules).

The only advice that cPanel gave me when doing this is:

It is possible this could break some components of cPanel, but it should be generally repairable as long as you run “/scripts/checkperlmodules –full –force” afterwards to rebuild/reinstall the cPanel versions of the various modules.

I suggest you also do that once imapsync is installed to ensure you don’t break anything in cPanel.

Migration

Now we have imapsync installed we can actually use it…

imapsync \
       --host1 mail.example.co.uk --authmech1 PLAIN --user1 [email protected] --password1 12345678 \
       --host2 lemon.phurix.com --authmech2 PLAIN --user2 [email protected] --password2 99999999

This should be enough to get you going, but do be aware of the SECURITY issues outlined in the imapsync README.

Once this is done, all you need to do is get the name servers (or just the MX) changed on the domain to new hosting and after about 4 hours you should be good to go.

]]>
https://hm2k.org/posts/migrating-imap-mailboxes-to-a-cpanel-server/feed 1 3322
Is Google PageRank dead? https://hm2k.org/posts/is-google-pagerank-dead https://hm2k.org/posts/is-google-pagerank-dead#comments Thu, 06 Oct 2011 21:30:30 +0000 http://labs.phurix.net/?p=3314 Related posts:
  1. PageRank Viewer Launch Back in 2007, we were developing code for our domain...
  2. Google PageRank Script Welcome to the home of the Google PageRank script. You’ll...
  3. The Google Translate recursion bug Recently I found a bug in Google Translate. It’s not...
  4. get_favicon() php function I was after a php function that would get the...
]]>
PageRank is dead, long live PageRank.

As we said recently, there’s been lots of speculation as to whether PageRank is dead or not. It isn’t, just Google are moving the goals a bit. Basically, they don’t want you to focus on PageRank but it’s still massively important to them.

All this talk of dead, reminds me of the Monty Python dead parrot sketch, only in this case, it isn’t dead. An anti-dead-parrot if you will.

So what’s with all the news about PageRank being dead? Google just changed their code, that’s all…

What’s going on then?

Originally, everyone used the code in the Internet Explorer plugin, then the Firefox plugin came along.

The common thing about both was the URL they used to lookup the PageRank:

http://toolbarqueries.google.com/search?client=navclient-auto&ch=%s&features=Rank&q=info:%s

Note: The first %s is the checkhash, while the second is the actual URL you’re looking up.

Back in August, James Slater was investigating the new Google Related chrome plugin only to discover the new PageRank lookup URLs:

http://toolbarqueries.google.com/tbr?client=navclient-auto&ch=%s&features=Rank&q=info:%s

Also, if you used to use the host “www.google.com” this no longer works either, use “toolbarqueries.google.com” instead.

Let there be code!

As part of our ongoing commitment to our PageRank lookup tool, not only have we fixed our code, but we’ve released working PageRank scripts to GitHub.

PageRank is dead, long live PageRank.

]]>
https://hm2k.org/posts/is-google-pagerank-dead/feed 5 3314
Integrate a newsletter into your website https://hm2k.org/posts/integrate-a-newsletter-into-your-website https://hm2k.org/posts/integrate-a-newsletter-into-your-website#comments Wed, 07 Sep 2011 13:26:56 +0000 http://labs.phurix.net/?p=3257 Related posts:
  1. British fuel cost per mile I was trying to work out how to estimate how...
  2. How to Copyright your website People often ask me how to go about getting their...
  3. PHP coding standards and best practices I have been using PHP for a long time now,...
  4. Free icon sets for your website If you don’t have the time to make your own...
]]>
Over the years I’ve been asked how to integrate a newsletter into a website quite a few times.

These days I often find myself recommending a third party service such as MailChimp, however I soon discovered that as brilliant as it is, MailChimp its not for everyone.

For example, many of our web hosting clients want to run their own mail campaigns through their own website rather than use a third party service.

What software should we use?

From memory there’s a few ways to do that:

  • Mailman – Installed with cPanel
  • PHPList – Install yourself or through fantastico, I’m not a fan
  • Majordomo – Not installed

There’s quite a few other “free mailing list” solutions and there’s plenty of alternatives to Mailman, but Mailman is the preferred option for us, mainly because it’s reliable and established…

“cPanel currently uses Mailman, which is an open source product under the GNU Project”

– Adam Wien, Systems Administrator

It’s reassuring when software is used by a vendor such as cPanel, as you know it’s likely to be supported for the foreseeable future.

It’s really easy to get started with the Mailman Mailing Lists in cPanel, however there’s even a video tutorial if you’re a little unsure.

Tip: When you setup your mailing list call it “newsletter” so its purpose is easy to identify.

Now we’ve decided what software we’re using and we’ve setup our newsletter mailing list, we can now actually integrate it with our website.

When I first started looking into this, there wasn’t many ways to integrate Mailman using PHP, just an outdated article entitled How do I integrate Mailman with PHP, or any other web enabling technology?

Don’t worry about that, because we’re here to help…

Introducing the Mailman Widget for WordPress

What we want to achieve here is a widget on our website so users are able to subscribe to our newsletter.

If you’re using WordPress, this is no problem as we’ve got a WordPress Plugin to do it for you:

Simply login to your WordPress site as you normally would and go to the Add New Plugin screen. Just look for the “Mailman Widget”. If in doubt, take a look at the Mailman Widget screenshots to help you out.

Not using WordPress? Don’t panic!

We can use exactly the same library that’s used in the Mailman Widget on any PHP based website.

Simply download the file and take a look at the example to get you started.

The future of PHP Mailman

In future, using PHP Mailman should be even easier as it is turned into a PHP Pear package called Services_Mailman.

You can now download the Pear package via github:

Simply click the download button and extract the files. You can either require it like a normal class or install it as a Pear package by running the following:

pear install package.xml

Once the proposal for Services_Mailman has been passed, you should be able to simply do “pear install Services_Mailman” as it will be added to the Pear channel.

In summary

I hope this helps make it easier for you to add a newsletter to your website. Despite the rise of social media (such as twitter) email is still the number 1 way to communicate online, so it’s never been more important to keep in touch with your customers or peers.

Good luck!

]]>
https://hm2k.org/posts/integrate-a-newsletter-into-your-website/feed 1 3257
Google’s Official Profanity API https://hm2k.org/posts/googles-official-profanity-api https://hm2k.org/posts/googles-official-profanity-api#comments Wed, 17 Aug 2011 10:09:15 +0000 http://labs.phurix.net/?p=3180 Related posts:
  1. The rise and fall of WhoisX WhoisX is a domain name lookup service, similar to the...
  2. What is my IP? An IP address is a unique number which identifies a...
  3. get_favicon() php function I was after a php function that would get the...
]]>
Recently a list of “bad words” were made available through Google’s new website which asks: “What do you love?” (wdyl.com).

So, perhaps I was a bit hasty writing off WhoisX.

The list of profanities was discovered in the Javascript on the website, however Google reacted quickly and switched this to a URL lookup instead of a Javascript one therefore keeping the list away from prying eyes.

However, what this does mean is now we have an API to play with:

http://www.wdyl.com/profanity?q=xxx

This will return a true JSON response:

{“response”: “true”}

While looking up something like “lol” will return a false response:

http://www.wdyl.com/profanity?q=lol

{“response”: “false”}

All in all a pretty simple and easy way to figure out whether Google thinks it is a bad word or not.

On the down side, you can’t easily use it on your site, as, if you try to call it by AJAX you’ll be faced by the following error:

XMLHttpRequest cannot load http://www.wdyl.com/profanity. Origin http://example.org is not allowed by Access-Control-Allow-Origin.

On the upside, we don’t want to do that anyway, we can to use it from PHP.

<?php

$q=isset($_REQUEST['q'])?urlencode($_REQUEST['q']):'';
readfile('http://www.wdyl.com/profanity?q='.$q);

?>

That’s right, that’s all there is to it. Simply copy that into the a file called “profanity.php” and you’re ready to go!

Now you can do a JSON call to your ‘profanity.php’ to tell you whether the word is bad or not.

If that’s not enough, you could try using the Google Profanity API to avoid displaying ads on pages that contain profanities.

Now if only there was a way to avoid the Scunthorp problem

Going back to the reported Adsense problem on WhoisX.co.uk, the example query was:

adult-hardcore-sex.cuntspace.me.uk

Passing this to the API returned false.

But, changing all the non-word characters to spaces has a different effect:

adult hardcore sex cuntspace me uk

{“response”: “true”}

This is done in PHP using a simple regular expression:

echo preg_replace(‘/[\W+]/’,’ ‘,’adult-hardcore-sex.cuntspace.me.uk’);

I’m not sure this exactly solves the Scunthorp problem, but it definitely does identify “sex” as an adult theme which is perfect.

Now to turn it into a usable function:

<?php

function is_profanity($q,$json=0) {
	$q=urlencode(preg_replace('/[\W+]/',' ',$q));
	$p=file_get_contents('http://www.wdyl.com/profanity?q='.$q);
	if ($json) { return $p; }
	$p=json_decode($p);
	return ($p->response=='true')?1:0;
}

$q=isset($_REQUEST['q'])?$_REQUEST['q']:'';
echo is_profanity($q);

?>

We can use this function to check whether the query is considered a profanity or not. If it is, it will return a 1, otherwise a 0 is returned.

This function can now be used to include kittens (or whatever) rather than Google Adsense Ads on a pages with “adult themed” content.

Brilliant!

Now to submit for reconsideration

]]>
https://hm2k.org/posts/googles-official-profanity-api/feed 2 3180
The rise and fall of WhoisX https://hm2k.org/posts/the-rise-and-fall-of-whoisx https://hm2k.org/posts/the-rise-and-fall-of-whoisx#comments Mon, 15 Aug 2011 08:33:38 +0000 http://labs.phurix.net/?p=3051 Related posts:
  1. Google’s Official Profanity API Recently a list of “bad words” were made available through Google’s new...
  2. get_favicon() php function I was after a php function that would get the...
  3. Google AdSense won’t let me in! Back in 2004, I signed up my old site “hm2k.org”...
  4. WhoisX relaunch We’re ready now… So, we’ve been running WhoisX since 2004,...
]]>
WhoisX is a domain name lookup service, similar to the whois service provided by “domain tools”, but ours was primarily for UK domain names.

It began as a small project to help people check whether a domain was available or not. When a domain was available the visitor was linked to a place they could buy the domain.

We developed out the project into more of a whois lookup service because this was useful to customers who wanted to see details about their domain using a web service rather than understanding how to do a whois lookup from the command line.

However, we soon came to realise that the site was causing a high load on the server because it was being hammered by bots. These bots were visiting thousands of URLs in an attempt to get WhoisX to generate a link back to them. Little do they know that, that’s not how it works.

The project was revamped with a whole load of new features including caching and load checking, which worked very well.

It no longer just did domain lookups either, it did hostnames (showing the “domain parts” making it easy to navigate), ip lookups, country code lookups, reverse ip lookups, mail server lookups and various dns queries all displayed within a few seconds.

We expanded the “social” aspect to make it easier to share and made it ad supported using Google Adwords.

Personally, I found the tool very useful to quickly check a domain, or drop a link into an email so customers could check for themselves.

This was all working great. The tool was useful to us and it was bringing in a small revenue, so it was all worth while.

However, this ended when Google emailed with the subject “AdSense ad serving has been disabled to your site”, the email went on to say:

Hello,

During a recent review of your account we found that you are currently
displaying Google ads in a manner that is not compliant with our program
policies
(https://www.google.com/support/adsense/bin/answer.py?answer=48182&stc=aspe-1pp-en).

————————————————–
EXAMPLE PAGE: http://whoisx.co.uk/adult-hardcore-sex.cuntspace.me.uk

Please note that this URL is an example and that the same violations may
exist on other pages of this website or other sites in your network.

VIOLATION(S) FOUND:

LINKS TO ADULT CONTENT: As stated in our program policies, AdSense
publishers are not permitted to place Google ads on pages with adult or
mature content. This includes displaying ads on pages that provide links
for or drive traffic to adult or mature sites. More information about this
policy can be found in our help center
(https://www.google.com/adsense/support/as/bin/answer.py?hl=en&answer=105957).

ADULT SEARCH RESULTS: As stated in our program policies, AdSense
publishers are not permitted to place Google ads on pages with adult or
mature content. This includes search results pages for adult or mature
terms, images or videos with adult keywords or tags, and user generated
comments that are mature in nature. More information about this policy can
be found in our help center (
https://www.google.com/adsense/support/as/bin/answer.py?hl=en&answer=105957
).

ACTION TAKEN: We have disabled ad serving to your site.

ACCOUNT STATUS: ACTIVE
Your AdSense account remains active. However, please note that our team
reserves the right to disable your account at any time. As such, we
encourage you to become familiar with our program policies and monitor
your network accordingly.

Issue ID# XXXXXXX

————————————————–
Thank you for your cooperation.

Sincerely,

The Google AdSense Team
—————-
For more information regarding this email, please visit our Help Center:
https://www.google.com/adsense/support/bin/answer.py?answer=113058&stc=aspe-ai4-en.

Although I agree with Google’s terms, this was an outside case and I couldn’t understand why they had chosen the example they had, since the “visit website” link on the page links to a website that doesn’t exist.

At the very worst, the URL contains an adult word, which is almost impossible to filter due to the “Scunthorpe problem” and that Google have not supplied a “bad word list” for us to work off.

This meant that without spending a lot of time on developing a very complex filter system so that ads aren’t displayed on pages containing potentially bad words, there was very little we could do about it.

So, this signals the end for WhoisX as we know it.

Consider this 30 days that the site will be closing down in it’s current form.

However, we do have plans to open a new domain lookup service, supported by Phurix in it’s place.

Watch this space!

]]>
https://hm2k.org/posts/the-rise-and-fall-of-whoisx/feed 1 3051
What is my IP? https://hm2k.org/posts/what-is-my-ip https://hm2k.org/posts/what-is-my-ip#respond Tue, 09 Aug 2011 08:48:14 +0000 http://labs.phurix.net/?p=3193 Related posts:
  1. Google’s Official Profanity API Recently a list of “bad words” were made available through Google’s new...
  2. PageRank Viewer Launch Back in 2007, we were developing code for our domain...
  3. Is Google PageRank dead? PageRank is dead, long live PageRank. As we said recently,...
  4. Over sixteen ways to obfuscate e-mail addresses Back in 2007 I wrote about email addresses on your...
]]>
An IP address is a unique number which identifies a machine on a network.

On the Internet IP addresses are allocated in blocks to ISPs in each country by regional registries, making it possible to identify which country an IP address originated in.

Often, if you are connected to the Internet behind a router, you share an online IP address with everyone else on your local area network (LAN).

Sometimes you need to know your external IP address and using something like ipconfig will only return your LAN IP address (something like 192.168.0.1).

That is why many “what is my ip” websites exist, making it easy for you to lookup your external IP address.

My favourite IP lookup service has been for a long time one run by NASDAQ-100 content delivery specialists “Akamai Technologies”:

It’s brilliant in its simplicity but it’s not very pretty.

We decided to do something different. We made a pretty “What is my IP address?” lookup:

Part of its beauty is that the audience its aimed at is able to quickly read and understand the information at a glance, without any prompts. While those who don’t understand it can marvel at its pretty form and ponder over its usefulness.

The other part of its beauty is that it’s highly parsable.

It’s easy to parse the IP address, mainly because the presentation (CSS) is separate from the markup (HTML), but also because of the headers.

Here’s a short demonstration to show how you can use the headers to get the IP address using this tool:

<?php $h=get_headers(‘http://ip.phurix.net’,1); echo trim($h[‘Location’],’/’); ?>

However, this method isn’t very portable, so may not be suitable if you’re checking against multiple sources at once.

So instead, we can also demonstrate using a simple regular expression and a function that can get http contents (such as file_get_contents() in PHP).

<?php echo preg_replace(‘/.*?(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}).*/s’,’$1′,file_get_contents(‘http://ip.phurix.net’));?>

The brilliance in this little snippet is that it will work with any useful “What is my IP?” lookup website.

So as you can see, it’s really easy to work with as a pretty API as well.

Beyond the IP address, you only need to look at the source code to understand that it’s easy to parse the other details.

I hope you found this useful!

]]>
https://hm2k.org/posts/what-is-my-ip/feed 0 3193
PageRank Viewer Launch https://hm2k.org/posts/pagerank-viewer-launch https://hm2k.org/posts/pagerank-viewer-launch#comments Wed, 03 Aug 2011 14:55:28 +0000 http://labs.phurix.net/?p=3142 Related posts:
  1. Is Google PageRank dead? PageRank is dead, long live PageRank. As we said recently,...
  2. Google PageRank Script Welcome to the home of the Google PageRank script. You’ll...
  3. get_favicon() php function I was after a php function that would get the...
  4. HM2K’s code repository HM2K’s code repository is now open for business! This repository...
]]>
Back in 2007, we were developing code for our domain lookup service.

One of the features we wanted was to display the Google PageRank of a domain right there in the lookup along side the whois details.

At the time we didn’t know how to pull this information and there was very limited details on it, so some research was required which resulted in a PageRank PHP script.

Over time, the resulting “pagerank.php” script became very popular and was developed further by fixing bugs and making it easier to use.

Now we wanted to show off our work in the form of a demo, so we launched a website…

We’ve had a demo of the PageRank Viewer online since 2010, but this week we’ve developed a whole new site along side entirely new code.

The original code we used was reverse engineered from the Internet Explorer toolbar, however it was much later that improved code based on the Google Toolbar for Mozilla Firefox surfaced.

The code from the Google Toolbar for Mozilla Firefox was interesting. By downloading the plugin “xpi” file, unzipping it and taking a look at the javascript you are able to see that Google regards PageRank quite highly or has sense of humour:

HASH_SEED_=”Mining PageRank is AGAINST GOOGLE’S TERMS OF SERVICE. Yes, I’m talking to you, scammer.”;

The simplicity of this code made it very easy to port over to any scripting language. So along side the launch of the all new PageRank Viewer website, we’re also shipping code in PHP, Python, Perl, TCL, C++ and D, all with the new code so you can write your own solution.

We bring this to you just in time too, there’s a perceived deprecation of PageRank after Google didn’t offer any official PageRank tool in their Google Chrome web browser.

PageRank was removed from webmaster tools, dismissed by a Google employee who said:

“it was silly to tell people not to think about it, but then to show them the data, implying that they should look at it”

– Susan Moskwa 14/10/2009

Although we agree with the point Google is trying to make, we felt there is still a lot of value on PageRank to webmasters.

For example, Google have made it very clear that having a reliable web hosting provider will help with ranking.

With that in mind, we decided to redevelop the PageRank Viewer and release new code to improve availability of PageRank lookups.

We welcome the all new PageRank Viewer to the family as a Phurix Labs project.

Enjoy!

]]>
https://hm2k.org/posts/pagerank-viewer-launch/feed 1 3142
Presenting Coinb.in https://hm2k.org/posts/presenting-coinb-in https://hm2k.org/posts/presenting-coinb-in#respond Wed, 27 Jul 2011 10:22:20 +0000 http://labs.phurix.net/?p=3070 Related posts:
  1. Tracking an IP address In my job I have to manage lots of machines...
  2. longip perl script I wanted to create a script that would convert a...
]]>
Bitcoin is a peer-to-peer cryto currency and we’ve been working on a free service for bitcoin users to help with accepting payments.

Coinb.in is what is known as a “Bitcoin eWallet Service” with an easily accessible API aimed at web developers, to allow the acceptance of bitcoins and to process the payments automatically and anonymously from our network via an unbranded interface, at no fee, without having to run a bitcoin client.

Coinb.in works by providing your customer with a unique wallet address, which is linked to your account. The coinb.in service then checks the Bitcoin p2p network at regular intervals. Once the payment has been confirmed, you will receive a notification by email and the transaction data will be sent to a script of your choice, which can then be used to process the order and populate your database.

There are a number of different ways to implement Coinb.in. The most simple and least complex way would be to implement a “buy it now” button, which does not require the user to register first.

For example, on a small project we run, called Gallush the following code could be added to a product page as a bitcoin “buy it now” button.

<script src="http://coinb.in/merchant.js"></script>
<script>
    var cb = {'uid':'2',
    'amount':'3.00',
    'fromcurrency':'USD',
    'description':'Starter shell. 1 month',
    'ref':'I10',
    'requestemail':1,
    'callback':'http://www.gallush.com/btc-payments.php'};
</script>
<a href="javascript:;" onClick="coinbin(cb);">Buy it now!</a>


Here’s an example: Buy it now!

The html and javascript above, would generate a link that would require no site registration because when it is clicked it will request that the visitor enters in their email address before they can continue, because of the &requestemail parameter being set.

Once the user has provided their email address, coinb.in will convert 3 USD to the equivalent value in bitcoins, and return this value plus an address to make a payment to.

The &description parameter  should contain a full description of the purchase and the &reference parameter in our example contains the item id (I10).

Once the user had made a payment, and it has been confirmed 6 times, all of the above data and additional transaction data is then sent to the callback URL provided so that it may populate the database and process the order accordingly.

Coinb.in comes complete with, examples, documentation and an API that can output the results into several different formats including XML and JSON objects

Now the question is, would you buy web hosting with bitcoins?

]]>
https://hm2k.org/posts/presenting-coinb-in/feed 0 3070