Skip to content

Instantly share code, notes, and snippets.

@sureshdsk
sureshdsk / facebook-graph-api-page.py
Last active March 25, 2019 15:23
Get number of likes of a facebook page using graph api in python
# http://www.idiotinside.com/2015/02/13/get-number-of-likes-of-a-facebook-page-using-graph-api-in-python/
import urllib2
import json
def get_page_data(page_id,access_token):
api_endpoint = "https://graph.facebook.com/v2.4/"
fb_graph_url = api_endpoint+page_id+"?fields=id,name,likes,link&access_token="+access_token
try:
api_request = urllib2.Request(fb_graph_url)
@sureshdsk
sureshdsk / geolocation-ip-address.php
Last active March 25, 2019 15:23
GeoLocation of an IP Address using PHP & Python
<?php
//Tutorial : http://www.idiotinside.com/2015/02/05/find-geolocation-of-an-ip-address-using-php-and-python/
$ipAddress = "IP_ADDRESS";
$ip_key = "YOUR_API_KEY";
$query = "http://api.ipinfodb.com/v3/ip-city/?key=" . $ip_key . "&ip=" . $ipAddress . "&format=json";
$json = file_get_contents($query);
$data = json_decode($json, true);
@sureshdsk
sureshdsk / check_email_exists.php
Created December 12, 2014 10:21
Check if an email is really exists or not
<?php function verifyEmail($toemail, $fromemail, $getdetails = false){
$email_arr = explode("@", $toemail);
$domain = array_slice($email_arr, -1);
$domain = $domain[0];
// Trim [ and ] from beginning and end of domain string, respectively
$domain = ltrim($domain, "[");
$domain = rtrim($domain, "]");
if( "IPv6:" == substr($domain, 0, strlen("IPv6:")) ) {
@sureshdsk
sureshdsk / curl_request.php
Created September 28, 2014 09:02
curl_request.php
$ch = curl_init($json_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type:application/json',
'Auth-Token:MYTOKEN'
));
$data_m = curl_exec($ch);
echo "<pre>";
print_r($data_m);
echo "</pre>";
@sureshdsk
sureshdsk / disable-right-click.js
Last active December 24, 2015 18:29
Disable right click using jquery
$(document).bind("contextmenu",function(e){
e.preventDefault();
alert('Right click disabled');
});