Skip to content

Instantly share code, notes, and snippets.

@unusorin
unusorin / imdb.php
Created September 19, 2012 13:02 — forked from silalahi/imdb.php
IMDb Wrapper Class PHP
<?php
/**
* IMDB Wrapper API
* Wrapper class to retrieve data from IMDB
* http://jogisilalahi.com/blog/imdb-api-wrapper-class-php
* @author Jogi Silalahi <silalahi.jogi@gmail.com>
*/
class IMDB
@unusorin
unusorin / gmaps.js
Created September 19, 2012 12:57
Google Maps helper functions
var GeoPosition;
/**
* get browser geolocation via html5
* @constructor
*/
function GetGeolocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
GeoPosition = position;
})
@unusorin
unusorin / wheater.php
Created September 19, 2012 12:42
IP or Domain Geolocation
function IPGeolocation($IpOrHostname,$Format="json"){
$response = file_get_contents("http://freegeoip.net/".$Format."/".$IpOrHostname);
return json_decode($response);
}
print_r(IPGeolocation("86.124.164.62"));
@unusorin
unusorin / wheater.php
Created September 19, 2012 12:07
coordinates for address
function getLatLong($address){
if (!is_string($address))die("All Addresses must be passed as a string");
$_url = sprintf('http://maps.google.com/maps?output=js&q=%s',rawurlencode($address));
$_result = false;
if($_result = file_get_contents($_url)) {
if(strpos($_result,'errortips') > 1 || strpos($_result,'Did you mean:') !== false) return false;
preg_match('!center:\s*{lat:\s*(-?\d+\.\d+),lng:\s*(-?\d+\.\d+)}!U', $_result, $_match);
$_coords['lat'] = $_match[1];
$_coords['long'] = $_match[2];
}
@unusorin
unusorin / wheater.php
Created September 19, 2012 12:07
Google favicon
function get_favicon($url){
$url = str_replace("http://",'',$url);
return "http://www.google.com/s2/favicons?domain=".$url;
}
@unusorin
unusorin / wheater.php
Created September 19, 2012 12:06
domain available php
function isDomainAvailible($domain)
{
//check, if a valid url is provided
if(!filter_var($domain, FILTER_VALIDATE_URL))
{
return false;
}
//initialize curl
$curlInit = curl_init($domain);
@unusorin
unusorin / currency.php
Created September 19, 2012 12:04
PHP Currency with google
<?php
function currency($from_Currency,$to_Currency,$amount) {
$amount = urlencode($amount);
$from_Currency = urlencode($from_Currency);
$to_Currency = urlencode($to_Currency);
$url = "http://www.google.com/ig/calculator?hl=en&q=$amount$from_Currency=?$to_Currency";
$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
@unusorin
unusorin / whois.php
Created September 19, 2012 12:02
PHP Whois
<?php
function whois_query($domain) {
// fix the domain name:
$domain = strtolower(trim($domain));
$domain = preg_replace('/^http:\/\//i', '', $domain);
$domain = preg_replace('/^www\./i', '', $domain);
$domain = explode('/', $domain);
$domain = trim($domain[0]);