Latest Post
Tampilkan postingan dengan label google. Tampilkan semua postingan
Tampilkan postingan dengan label google. Tampilkan semua postingan

Convert currency using google finance calculator in php

Written By Unknown on Rabu, 27 November 2013 | 09.24

Earlier we used to Convert currency using Google api. But as Google has closed its iGoogle service from 1st Nov 2013, this api will no longer work. But we have an alternative to convert currency using google finance calculator.

Here is a little code snippet that can be used to convert currency from one format to another.
It takes three parameters The amount to be converted, convert from and convert to


<?php
function convertCurrency($amount, $from, $to){
$url = "https://www.google.com/finance/converter?a=$amount&from=$from&to=$to";
$data = file_get_contents($url);
preg_match("/<span class=bld>(.*)<\/span>/",$data, $converted);
$converted = preg_replace("/[^0-9.]/", "", $converted[1]);
return round($converted, 3);
}

# Call function
echo convertCurrency(1, "USD", "INR");
?>

The above php function returns something like 62.285

The Currency formats can be of following types



AED => United Arab Emirates Dirham (AED)
AFN => Afghan Afghani (AFN)
ALL => Albanian Lek (ALL)
AMD => Armenian Dram (AMD)
ANG => Netherlands Antillean Guilder (ANG)
AOA => Angolan Kwanza (AOA)
ARS => Argentine Peso (ARS)
AUD => Australian Dollar (A$)
AWG => Aruban Florin (AWG)
AZN => Azerbaijani Manat (AZN)
BAM => Bosnia-Herzegovina Convertible Mark (BAM)
BBD => Barbadian Dollar (BBD)
BDT => Bangladeshi Taka (BDT)
BGN => Bulgarian Lev (BGN)
BHD => Bahraini Dinar (BHD)
BIF => Burundian Franc (BIF)
BMD => Bermudan Dollar (BMD)
BND => Brunei Dollar (BND)
BOB => Bolivian Boliviano (BOB)
BRL => Brazilian Real (R$)
BSD => Bahamian Dollar (BSD)
BTN => Bhutanese Ngultrum (BTN)
BWP => Botswanan Pula (BWP)
BYR => Belarusian Ruble (BYR)
BZD => Belize Dollar (BZD)
CAD => Canadian Dollar (CA$)
CDF => Congolese Franc (CDF)
CHF => Swiss Franc (CHF)
CLF => Chilean Unit of Account (UF) (CLF)
CLP => Chilean Peso (CLP)
CNH => CNH (CNH)
CNY => Chinese Yuan (CN¥)
COP => Colombian Peso (COP)
CRC => Costa Rican Colรณn (CRC)
CUP => Cuban Peso (CUP)
CVE => Cape Verdean Escudo (CVE)
CZK => Czech Republic Koruna (CZK)
DEM => German Mark (DEM)
DJF => Djiboutian Franc (DJF)
DKK => Danish Krone (DKK)
DOP => Dominican Peso (DOP)
DZD => Algerian Dinar (DZD)
EGP => Egyptian Pound (EGP)
ERN => Eritrean Nakfa (ERN)
ETB => Ethiopian Birr (ETB)
EUR => Euro (€)
FIM => Finnish Markka (FIM)
FJD => Fijian Dollar (FJD)
FKP => Falkland Islands Pound (FKP)
FRF => French Franc (FRF)
GBP => British Pound Sterling (£)
GEL => Georgian Lari (GEL)
GHS => Ghanaian Cedi (GHS)
GIP => Gibraltar Pound (GIP)
GMD => Gambian Dalasi (GMD)
GNF => Guinean Franc (GNF)
GTQ => Guatemalan Quetzal (GTQ)
GYD => Guyanaese Dollar (GYD)
HKD => Hong Kong Dollar (HK$)
HNL => Honduran Lempira (HNL)
HRK => Croatian Kuna (HRK)
HTG => Haitian Gourde (HTG)
HUF => Hungarian Forint (HUF)
IDR => Indonesian Rupiah (IDR)
IEP => Irish Pound (IEP)
ILS => Israeli New Sheqel (₪)
INR => Indian Rupee (Rs.)
IQD => Iraqi Dinar (IQD)
IRR => Iranian Rial (IRR)
ISK => Icelandic Krรณna (ISK)
ITL => Italian Lira (ITL)
JMD => Jamaican Dollar (JMD)
JOD => Jordanian Dinar (JOD)
JPY => Japanese Yen (¥)
KES => Kenyan Shilling (KES)
KGS => Kyrgystani Som (KGS)
KHR => Cambodian Riel (KHR)
KMF => Comorian Franc (KMF)
KPW => North Korean Won (KPW)
KRW => South Korean Won (₩)
KWD => Kuwaiti Dinar (KWD)
KYD => Cayman Islands Dollar (KYD)
KZT => Kazakhstani Tenge (KZT)
LAK => Laotian Kip (LAK)
LBP => Lebanese Pound (LBP)
LKR => Sri Lankan Rupee (LKR)
LRD => Liberian Dollar (LRD)
LSL => Lesotho Loti (LSL)
LTL => Lithuanian Litas (LTL)
LVL => Latvian Lats (LVL)
LYD => Libyan Dinar (LYD)
MAD => Moroccan Dirham (MAD)
MDL => Moldovan Leu (MDL)
MGA => Malagasy Ariary (MGA)
MKD => Macedonian Denar (MKD)
MMK => Myanma Kyat (MMK)
MNT => Mongolian Tugrik (MNT)
MOP => Macanese Pataca (MOP)
MRO => Mauritanian Ouguiya (MRO)
MUR => Mauritian Rupee (MUR)
MVR => Maldivian Rufiyaa (MVR)
MWK => Malawian Kwacha (MWK)
MXN => Mexican Peso (MX$)
MYR => Malaysian Ringgit (MYR)
MZN => Mozambican Metical (MZN)
NAD => Namibian Dollar (NAD)
NGN => Nigerian Naira (NGN)
NIO => Nicaraguan Cรณrdoba (NIO)
NOK => Norwegian Krone (NOK)
NPR => Nepalese Rupee (NPR)
NZD => New Zealand Dollar (NZ$)
OMR => Omani Rial (OMR)
PAB => Panamanian Balboa (PAB)
PEN => Peruvian Nuevo Sol (PEN)
PGK => Papua New Guinean Kina (PGK)
PHP => Philippine Peso (Php)
PKG => PKG (PKG)
PKR => Pakistani Rupee (PKR)
PLN => Polish Zloty (PLN)
PYG => Paraguayan Guarani (PYG)
QAR => Qatari Rial (QAR)
RON => Romanian Leu (RON)
RSD => Serbian Dinar (RSD)
RUB => Russian Ruble (RUB)
RWF => Rwandan Franc (RWF)
SAR => Saudi Riyal (SAR)
SBD => Solomon Islands Dollar (SBD)
SCR => Seychellois Rupee (SCR)
SDG => Sudanese Pound (SDG)
SEK => Swedish Krona (SEK)
SGD => Singapore Dollar (SGD)
SHP => Saint Helena Pound (SHP)
SLL => Sierra Leonean Leone (SLL)
SOS => Somali Shilling (SOS)
SRD => Surinamese Dollar (SRD)
STD => Sรฃo Tomรฉ and Prรญncipe Dobra (STD)
SVC => Salvadoran Colรณn (SVC)
SYP => Syrian Pound (SYP)
SZL => Swazi Lilangeni (SZL)
THB => Thai Baht (฿)
TJS => Tajikistani Somoni (TJS)
TMT => Turkmenistani Manat (TMT)
TND => Tunisian Dinar (TND)
TOP => Tongan Paสปanga (TOP)
TRY => Turkish Lira (TRY)
TTD => Trinidad and Tobago Dollar (TTD)
TWD => New Taiwan Dollar (NT$)
TZS => Tanzanian Shilling (TZS)
UAH => Ukrainian Hryvnia (UAH)
UGX => Ugandan Shilling (UGX)
USD => US Dollar ($)
UYU => Uruguayan Peso (UYU)
UZS => Uzbekistan Som (UZS)
VEF => Venezuelan Bolรญvar (VEF)
VND => Vietnamese Dong (₫)
VUV => Vanuatu Vatu (VUV)
WST => Samoan Tala (WST)
XAF => CFA Franc BEAC (FCFA)
XCD => East Caribbean Dollar (EC$)
XDR => Special Drawing Rights (XDR)
XOF => CFA Franc BCEAO (CFA)
XPF => CFP Franc (CFPF)
YER => Yemeni Rial (YER)
ZAR => South African Rand (ZAR)
ZMK => Zambian Kwacha (1968-2012) (ZMK)
ZMW => Zambian Kwacha (ZMW)
ZWL => Zimbabwean Dollar (2009) (ZWL)


Display Top URLs With Google Analytics API with PHP

Written By Unknown on Selasa, 23 Juli 2013 | 08.49

We can use Core Reporting API to fetch top (Popular) URLs from Google Analytics. Using Google API PHP Client let’s create a simple PHP page that pulls website’s top URLs from Google Analytics and updates MySql table. Once you are familiar, I am sure you can do lot more, I mean just checkout the information you can retrieve in this Reporting API.


To read more about this article Click Here

For Demo Click Here

To download files Click Here

Google Powered Shopping Search with jQuery and PHP

Written By Unknown on Rabu, 14 November 2012 | 08.59

In this tutorial, we will be making a simple product search engine. Using jQuery and PHP, we will tap into Google’s Shopping Search API and return a list of items available for purchase, along with prices, photos and other useful information. 

The Shopping Search API gives us direct access to Google’s large database of products and prices, obtained from partnering online stores. Another benefit to using this service, is that products are automatically ranked and filtered for us behind the scenes to better match with the user’s search query.

To read more about this article Click Here

For Demo Click Here

 To Download files Click Here

Add Google Map to your website

Written By Unknown on Rabu, 19 September 2012 | 00.23

Adding maps to your site is quite easy with Google Maps Api V3.
Before you proceed with the working with Google Map Api you need an API Key from Google. You can create an API Key by signing into your Google Account.

To create your API key follow the instructions:
  1. Visit the APIs Console at https://code.google.com/apis/console
  2. Log in with your Google Account.
  3. Click the Services link from the left-hand menu.
  4. Activate the Google Maps API v3 service.
  5. Click the API Access link from the left-hand menu.
You will get your API Key under Simple API Access section.

Now you are ready to Create a Google Map. Use your own API Key in the following url used in the sample code.

http://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&sensor=false_or_true

Sample code is given here


<!DOCTYPE html>
<html>
<head>
<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyCEnBxzr2jFxZ7zrZ0LcT-lx6ojzFijk3U&sensor=false">
</script>

<script>
var place=new google.maps.LatLng(28.632778,77.219722);

function initialize(){
var param = {
center:place,
zoom:12,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map=new google.maps.Map(document.getElementById("myMap"),param);

var marker=new google.maps.Marker({
position:place
});
marker.setMap(map);
}
google.maps.event.addDomListener(window,'load',initialize);
</script>
</head>
<body>
<div id="myMap" style="width:450px;height:320px;"></div>
</body>
</html>


Output of the above code


jMapping : jQuery plugin for creating Google Maps from semantic markup

Written By Unknown on Senin, 16 Juli 2012 | 10.36

This plugin is designed for quick development of a page that implements a Google Map with a list of the locations that are specified within the HTML.

The plugin tries to allow as much graceful degradation as possible by having the HTML be as semantic as possible. The plugin expect the HTML for the locations to be grouped under a common element. Additionally, it expects the links and Map Info Window content to be grouped under the location elements. It also expects the necessary metadata to be on the location element. This way the HTML semantically reflects that all of those parts and information are associated with the specific location or place.


To read more about this article Click Here

For Demo Click Here



 

Google Plus Style Drag and Drop adding Groups with jQuery

Written By Unknown on Selasa, 24 April 2012 | 10.05

Are you looking for Google plus style drag and drop adding friends in groups or circle. Google plus circle implementation so cool, same way I have tried similar user groups adding application with drag and drop effect using jquery and php.


To read more about this article Click Here

For Demo Click Here



Get favicon of any website

Written By Unknown on Kamis, 19 April 2012 | 09.06

It is quite easy to get favicon of any site using google. Look at the code



http://www.google.com/s2/favicons?domain=example.com


Examples

<img src="http://www.google.com/s2/favicons?domain=google.com" />
<img src="http://www.google.com/s2/favicons?domain=youtube.com" />
<img src="http://www.google.com/s2/favicons?domain=yahoo.com" />

Output
 
Google faviconYoutube faviconYahoo favicon


Currency converter in php using google api

Written By Unknown on Senin, 18 Juli 2011 | 03.40

This api will no longer work as google has closed its iGoogle service from Nov 1, 2013. You may find this alternative method to Convert currency from one format to another.
Hello friends. Here is the google api code to convert the currency from one format to another. You have to pass just three parameteres. i.e. From currency, To currency and the amount to be converted. It will return the converted amount.



function convertCurrency($from,$to,$amount) {
$amount = urlencode($amount);
$from = urlencode($from);
$to = urlencode($to);
$url = "http://www.google.com/ig/calculator?hl=en&q=$amount$from=?$to";
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13";

$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_USERAGENT, $agent);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 10);

$rawdata = curl_exec($ch);
curl_close($ch);

$data = explode('"', $rawdata);
$data = explode(' ', $data['3']);
$var = $data['0'];
return round($var,3);
}


Call function
echo convertCurrency('USD','INR',1);

How to add google translator to your website

Written By Unknown on Senin, 18 April 2011 | 01.27

Hey friends. Want to add google translator on your website. It can be be added in different ways. Here two layouts are given. Just copy and paste the code into your webpage.

Google Translate
 <div id="google_translate"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en',
layout: google.translate.TranslateElement.InlineLayout.
SIMPLE },'google_translate');
}
</script>
<script src="http://translate.google.com/translate_a/
element.js?cb=googleTranslateElementInit"></script>



Translate This
 <div id="translate-this">
<a href="http://translateth.is/"
class="translate-this-button">Translate</a></div>
<script src="http://www.google.com/jsapi"></script>
<script src="http://x.translateth.is/translate-this.js">
</script>
<script type="text/javascript">TranslateThis();</script>

Retrieve Google Analytics Visits and PageViews with PHP

Written By Unknown on Senin, 24 Mei 2010 | 22.33

Google Analytics is an outstanding website analytics tool that gives you way more information about your website than you probably need. Better to get more than you want than not enough, right? 


Anyways I check my website statistics more often than I should and it ends up taking a few minutes to get logged in, select the right site, select the current day, etc. I found a great Google Analytics PHP API that allows me to get just the statistics I’m looking for.


The PHP Library

The PHP class I found, analytics, can be downloaded at http://www.swis.nl/ga/. The site also gives a few solid examples.

The PHP


//session_start for caching, if desired
session_start();
//get the class
require 'ga/analytics.class.php';
//sign in and grab profile
$analytics = new analytics('david@davidwalsh.name', 'myP@ssw0rd');
$analytics->setProfileByName('davidwalsh.name');
//set the date range for which I want stats for (could also be $analytics->setDateRange('YYYY-MM-DD', 'YYYY-MM-DD'))
$analytics->setMonth(date('n'), date('Y'));
//get array of visitors by day
print_r($analytics->getVisitors());
//get array of pageviews by day
print_r($analytics->getPageviews());

As you’d expect, we first grab the class and immediately sign providing your credentials and website profile (you can just use your domain). Once authenticated we set a date range and retrieve our visitors and pageviews.

The Sample PHP Results

The above code retrieved visits and pageviews for the current month. What’s returned is an array that looks as follows:
Array
(
    [01] => 6539
    [02] => 6677
    [03] => 6160
    [04] => 5563
    [05] => 2964
    [06] => 2973
    [07] => 5080
    [08] => 6078
    [09] => 5927
    [10] => 6177
...
)
A very simple array numbered by day. You could do anything you wanted with the array — create averages, peaks, lows, etc.

Advanced Usage

The analytics class also allows you to retrieve search keywords and anything else you might like:
$keywords = $analytics->getData(array(
'dimensions' => 'ga:keyword',
               'metrics' => 'ga:visits',
               'sort' => 'ga:keyword'
)
);
The PHP analytics class is a masterpiece. Rest assured I’ll be doing a ton of work with this class for customers and my own websites

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Kumpulan Kata Broadcast Blackberry - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger