Please find the source and instructions @ https://github.com/kartheekgj/paypalnodeIntegration
All about very small logical and programming problems. Complex theories made simple to understand
Showing posts with label API. Show all posts
Showing posts with label API. Show all posts
Tuesday, September 7, 2021
Friday, June 28, 2013
Create QR code generator using php-curl
$url = "https://chart.googleapis.com/chart?";
$strPost = "cht=qr&chs=177x177&chl=http://opendummies.blogspot.in/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
// curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPGET,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: image/jpeg"));
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $strPost); // add POST fields
curl_setopt($ch, CURLOPT_POST, 1);
header('Content-Type: image/jpeg');
echo $result = curl_exec($ch);
curl_close($ch);
output:
Tuesday, June 25, 2013
URL shortner using Bitly - PHP
For creating a shorten url you need to create an account in the following link:
http://dev.bitly.com/my_apps.html
Now go to
https://bitly.com/a/oauth_apps
Here you need to create a accesstoken if you are creating for the first time it prompts for the password.
Then you get a alpha numeric value as accesstoken section.
Now use the following Code:
$url = "https://api-ssl.bitly.com/v3/shorten";
$strPost = "longUrl=http%3A%2F%2Fgoogle.com%2F& access_token=YOUR ACCESSTOKEN";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
// curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPGET,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/json"));
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $strPost); // add POST fields
curl_setopt($ch, CURLOPT_POST, 1);
$result = curl_exec($ch);
var_dump($result);
curl_close($ch);
The output of this file will return a json string
"status_code" : 200,
"status_txt" : "OK",
"data" : {
"long_url" : "http:\/\/google.com\/",
"url" : "http:\/\/bit.ly\/14UO8lv",
"hash" : "14UO8lv",
"global_hash" : "900913",
"new_hash" : 1
}
}
NOTE
The bitly code is to be used for personal accounts cannot be used for Enterprise use if you want to use it for Enterprise you need to request them for the details but this code even works for that Code too.
http://dev.bitly.com/my_apps.html
Now go to
https://bitly.com/a/oauth_apps
Here you need to create a accesstoken if you are creating for the first time it prompts for the password.
Then you get a alpha numeric value as accesstoken section.
Now use the following Code:
$url = "https://api-ssl.bitly.com/v3/shorten";
$strPost = "longUrl=http%3A%2F%2Fgoogle.com%2F& access_token=YOUR ACCESSTOKEN";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
// curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPGET,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/json"));
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $strPost); // add POST fields
curl_setopt($ch, CURLOPT_POST, 1);
$result = curl_exec($ch);
var_dump($result);
curl_close($ch);
The output of this file will return a json string
{"status_code" : 200,
"status_txt" : "OK",
"data" : {
"long_url" : "http:\/\/google.com\/",
"url" : "http:\/\/bit.ly\/14UO8lv",
"hash" : "14UO8lv",
"global_hash" : "900913",
"new_hash" : 1
}
}
NOTE
The bitly code is to be used for personal accounts cannot be used for Enterprise use if you want to use it for Enterprise you need to request them for the details but this code even works for that Code too.
Google shorten URL - a Simple CURL script
$url = "https://www.googleapis.com/urlshortener/v1/url"; $strPost = '{"longUrl": "YOUR LONG URL"}'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); //if your are using proxy url use proxy setting // curl_setopt($ch, CURLOPT_PROXY, $proxy); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_HTTPGET,1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/json")); //since i am requesting json response curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_POSTFIELDS, $strPost); // add POST fields curl_setopt($ch, CURLOPT_POST, 1); $result = curl_exec($ch); var_dump($result); curl_close($ch); exit; If you dont want to use the google url shortner want to create your own check it here : http://opendummies.blogspot.in/2014/07/creating-url-shortner.html |
Tuesday, March 20, 2012
OAuth 2.0
Now its time to Switch on the easier and secured version of OAuth Protocol OAuth 2.0 so here is the presentation i have made which makes u people easy to understand the Protocol and important points to have talk to the server
Presentation - Download
The presentation is based on the Oauth 2.0 written by the developers of Microsoft and Facebook on January 2012
Presentation - Download
The presentation is based on the Oauth 2.0 written by the developers of Microsoft and Facebook on January 2012
Friday, March 2, 2012
Curl Using PHP in a Gist
cURL: It is a client that deals with URL so its named as cURL so as to say that it deals with URL only
It is used to make client communicate with the server using command line
arguments using cURL syntax
Its main use is to provide security to the URL's sent through the browser to the server
The main commands in cURL which i found is important are
1. curl_init() - with which the main curl operation starts
2.curl_setop($charecter,options,value) -
$charecter = curl handle returned by curl_initi()
It is used to make client communicate with the server using command line
arguments using cURL syntax
Its main use is to provide security to the URL's sent through the browser to the server
The main commands in cURL which i found is important are
1. curl_init() - with which the main curl operation starts
2.curl_setop($charecter,options,value) -
$charecter = curl handle returned by curl_initi()
options = curl provides various options with general syntax
curlOPT_XXX
curlOPT_XXX
other options are found in - PHP website
value = value of the url
3. curl_exec() - which is used to execute a $charecter in which the information has be moved
4.curl_close() - this is used to close the curl connection
Thursday, March 1, 2012
Connect With Facebook API in Simple 7 Steps
Here is the presentation or Document Where i have described Simple 7 Steps To Connect to Facebook this can be used to any Social Networking Site
Download the Presentation From this Link ---- Download
Download the Presentation From this Link ---- Download
Subscribe to:
Posts (Atom)