You can use this PHP code snippet to create short URL from your website: $long_url, 'keyword' => $keyword )); // Fetch and return content $data = curl_exec($ch); curl_close($ch); // Do something with the result. Here, we just return it. if(!empty($data) && strpos($data, 'rupom.net/')) { return $data; } else { return $long_url; } } // set inputs $long_url = 'http://rupom.wordpress.com/2009/10/07/i-have-been-a-proud-father-found-meaning-of-life/'; $keyword = 'fatherhood'; // call the function $short_url = createShortURL($long_url, $keyword); // print the output echo "Long URL: $long_url"; echo "Short URL: $short_url"; ?>