Wednesday, 6 August 2014

SMTP Host name by different mail server

Gmail: smtp.gmail.com
Yahoomail: smtp.mail.yahoo.com
Godaddy: relay-hosting.secureserver.net
Rediff: smtp.rediffmail.com

Get address by using lattitude and longitude Google APi

<?php

echo getAddress("28.6100", "77.2300");

function getaddress($lat,$lng)
{
$url = 'http://maps.googleapis.com/maps/api/geocode/json?latlng='.trim($lat).','.trim($lng).'&sensor=false';
$json = @file_get_contents($url);
$data=json_decode($json);
$status = $data->status;
if($status=="OK")
return $data->results[0]->formatted_address;
else
return false;
}
?>

First Data Global Gateway - Payment gateway integration

lt;?php ini_set('display_errors', '1'); $url = 'https://api.demo.globalgatewaye4.firstdata.com/transaction/v11'; $data = array( "gateway_id" => "xxxxxxx", //YOUR GATEWAY ID "password" => "xxxxxxxx", // YOOUR GATEWAY PASSWORD "transaction_type" => "00", "amount" => "11", "cardholder_name" => "Test", "cc_number" => "4111111111111111", "cc_expiry" => "0314" ); $data_string= json_encode($data); // Initializing curl $ch = curl_init( $url ); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=UTF-8;','Accept: application/json' )); // Getting results $result = curl_exec($ch); // Getting jSON result string $data_string = json_decode($result); if ($data_string) { if ($data_string->bank_resp_code == '100') { print('Approved!'); } else { print($data_string->bank_message); } } else { print($result); } ?>

Facebook embed your website

Instead, I would try this site, iframehost, to install your Iframe and embed your blog.
Log in to Facebook.
Go to this page.
Click “install page tab.”
Choose the business page to which you want to embed your blog.
Click “authorize the tab application.”
In the bottom left-hand corner of the text box that appears, change the drop down menu to “only me.”
Beside “page source” click on “URL” and enter the URL you want to embed.
Change the tab name and image. You will also be able to change these later.
Click “Save Settings” and then allow the application to access your business page.
Go to your business page and check that your tab is working appropriately.

Ref: http://writerswin.com/new-options-to-embed-your-website-on-facebook/ 

By using PHP unzip zip files with source code

<?php
$zip = new ZipArchive;
$res = $zip->open('demo.zip');
if ($res === TRUE) {
$zip->extractTo('test/');
$zip->close();
echo 'woot!';
} else {
echo 'doh!';
}
?>

Tuesday, 5 August 2014

Bootstrap Off Canvas nav toggle viewing windows size

$(document).ready(function () {
$('[data-toggle=offcanvas]').click(function () {
$('.row-offcanvas').toggleClass('active')
});
});

Monday, 4 August 2014

How to determine if an ip within specific range or not by using php?

$lower = "0.0.0.0.0";
$upper = "255.255.255.255";
$ip = "0.0.0.10";
$lower_dec = (float)sprintf("%u",ip2long($lower));
$upper_dec = (float)sprintf("%u",ip2long($upper));
$ip_dec = (float)sprintf("%u",ip2long($ip));
if( ($ip_dec>=$lower_dec) && ($ip_dec<=$upper_dec) ){
echo "True";
}else{
echo "False";
}

Feet/Inches to Meters Converter & Lbs to Kgs Converter

 <!DOCTYPE html> <html lang="en"> <head>   <meta charset="UTF-8" />   <title>Feet/Inches ⇄...