Free-Email Lookup PHP Script

This is a php code snippet that I wrote for a website. Thought it might be useful for some one else as I was unable to find any API to check whether the given email address is a free one or not.

There are thousands of websites provide free email address like Yahoo or Gmail.

This database has over 1000 free email id providers.

$email = $_REQUEST[’email’];
$data = json_decode(file_get_contents("$email"),true);
echo ‘<pre>’;


The direct link to the API is

You’ll get a JSON encoded result. Converting it to array, you will get

[result] => true
[email] =>
[description] => is believed to be a free email provider
[provider] =>

Result = True, means the email provider is a free email provider.
Hope this helps.

PHP Get The Current URL Path

I am not quite sure PHP has inbuilt function for this requirement. While I was coding script for PayPal integration, I had to notify PayPal for IPN url for acknowledging the payment. The IPN script was located elsewhere, ie, on another directory, so I used a custom function to get the current URL path and added the IPN file location to that url. This code will make sure that it return the correct URL even through you are running webserver on non-standard port ( ie, other than port 80).

function getcurrentpath()
{ $curPageURL = "";
if ($_SERVER["HTTPS"] != "on")
$curPageURL .= "http://";
$curPageURL .= "https://" ;
if ($_SERVER["SERVER_PORT"] == "80")
$count = strlen(basename($curPageURL));
$path = substr($curPageURL,0, -$count);
return $path ;

echo getcurrentpath();

For example, the script is located at

Then the output will be

You can tweak the script according to your requirements (such as removing the trailing slash). Enjoy coding!