You want to use misso api to connect and getting user data then follow the following step.
1.Go to this url http://gomiso.com/developers/sample_code and download your code of php.
2. Extract the code and there is two file.
a) request.php
b) callback.php
3. Just change your consumer key and consumer secret key.
4. Now go to the following url, download oauth-php-175.tar.gz.
http://code.google.com/p/oauth-php/downloads/detail?name=oauth-php-175.tar.gz&can=2&q=
5. After extract there is an oauth-php folder, place this folder with request and callback php file, according to your include_once "oauth-php/library/OAuthStore.php"; in request file.
6.Create a database php_test.
7.Open oauth-php folder and go to sql file, Path is following.
oauth-php\library\store\mysql\mysql.sql => Import this file in your database.
8. Most important thing change your $callback_uri path in request.php file, My path is like this
$callback_uri = 'http://localhost/oauth/misso/callback.php';//line 31(request.php)
9. for every time test empty oauth_consumer_registry table,other wise give error because you are doing same authentication second time for same user. other wise give error already exist.
10. Run your request.php and authorize the user on callback.php return user information.
11. use this information.
Download Misso Api and Oauth Authentication document of all detail from following
Misso API
For all view click on following.
http://www.docstoc.com/docs/document-preview.aspx?doc_id=104879280
PHP API
Thursday, 24 November 2011
Monday, 21 November 2011
Google Weather API
Instruction:-
1. You can take an array at the place of $place_Name.
2. If any place temperature not shown this mean Google have no value that time
3. This an array run in for each
4. There is using if and else condition
5. because some city/state/country name does not support xml
6. Just copy and paste the code definately run
7. There is no error in file
8. Just change your place name on here
1. You can take an array at the place of $place_Name.
2. If any place temperature not shown this mean Google have no value that time
3. This an array run in for each
4. There is using if and else condition
5. because some city/state/country name does not support xml
6. Just copy and paste the code definately run
7. There is no error in file
8. Just change your place name on here
//Copy code from here.
$place_Name = 'chandigarh';
$googleApiLink= "http://www.google.com/ig/api?weather=".$place_Name."&hl=en";
$xmlFunctionForDataLoad = @simplexml_load_file($googleApiLink);
if($xmlFunctionForDataLoad)
{
$gettingWeatherData = $xmlFunctionForDataLoad->xpath("/xml_api_reply/weather/forecast_information");
$getData = $xmlFunctionForDataLoad->xpath("/xml_api_reply/weather/current_conditions");
$forecast_list = $xmlFunctionForDataLoad->xpath("/xml_api_reply/weather/forecast_conditions");
}
else
{
$url = file_get_contents($googleApiLink);
$xmlFunctionForDataLoad = iconv("iso-8859-1", "utf-8", $url);
$xmlFunctionForDataLoad = simplexml_load_string($xmlFunctionForDataLoad);
$information = $xmlFunctionForDataLoad->xpath("/xml_api_reply/weather/forecast_information");
$getData = $xmlFunctionForDataLoad->xpath("/xml_api_reply/weather/current_conditions");
$forecast_list = $xmlFunctionForDataLoad->xpath("/xml_api_reply/weather/forecast_conditions");
}
echo ucfirst($place_Name).' => '.$getData[0]->temp_c['data'].'°C';
//End of the code on there
$place_Name = 'chandigarh';
$googleApiLink= "http://www.google.com/ig/api?weather=".$place_Name."&hl=en";
$xmlFunctionForDataLoad = @simplexml_load_file($googleApiLink);
if($xmlFunctionForDataLoad)
{
$gettingWeatherData = $xmlFunctionForDataLoad->xpath("/xml_api_reply/weather/forecast_information");
$getData = $xmlFunctionForDataLoad->xpath("/xml_api_reply/weather/current_conditions");
$forecast_list = $xmlFunctionForDataLoad->xpath("/xml_api_reply/weather/forecast_conditions");
}
else
{
$url = file_get_contents($googleApiLink);
$xmlFunctionForDataLoad = iconv("iso-8859-1", "utf-8", $url);
$xmlFunctionForDataLoad = simplexml_load_string($xmlFunctionForDataLoad);
$information = $xmlFunctionForDataLoad->xpath("/xml_api_reply/weather/forecast_information");
$getData = $xmlFunctionForDataLoad->xpath("/xml_api_reply/weather/current_conditions");
$forecast_list = $xmlFunctionForDataLoad->xpath("/xml_api_reply/weather/forecast_conditions");
}
echo ucfirst($place_Name).' => '.$getData[0]->temp_c['data'].'°C';
//End of the code on there
1. Following given the document of this code.
2. You can read instruction and download code from below
3. See the following document and download
For Full Screen Click :-Google Weather API
Sunday, 20 November 2011
Amazon S3 (Simple Storage Services)
Amazon S3 is storage for the Internet. Amazon provides the space for large amount of data storing.The data will be upload from your site but store on amazon, your site just save the name of file.From file name data also retrieve on your site from amazon.
For implementation on website just follow the following step.
1. Download the code from following and extract.
2. There are three file containing style.css, s3.php and page.php. Don't touch other files only open page.php
and define access, secret key . Following red word, you need to change with your given Amazon keys.
if (!defined('awsAccessKey')) define('awsAccessKey', 'CHANGE THIS');
if (!defined('awsSecretKey')) define('awsSecretKey', 'CHANGE THIS TOO');
3. You need to change your bucket name in follwing code. Write your bucket name on place of yourbucket.
remember yourbucket is your object and you can only made 100 bucket in one account.
$s3->putBucket("yourbucket", S3::ACL_PUBLIC_READ);
4. Only Change these avobe red highlighted words and your task is complete.
5. For uploading change in following code.
if(isset($_POST['Submit'])){
$fileName = $_FILES['filenamechange']['name'];
$fileTempName = $_FILES['filenamechange']['tmp_name'];
$s3->putBucket("yourbucket", S3::ACL_PUBLIC_READ);
if ($s3->putObjectFile($fileTempName, "yourbucket", $fileName, S3::ACL_PUBLIC_READ)) {
echo "<strong>We successfully uploaded your file.</strong>";
}else{
echo "<strong>Something went wrong while uploading your file... sorry.</strong>";
}
}
6. Retrieve data from following code.
$contents = $s3->getBucket("yourbucket");
foreach ($contents as $file){
$fname = $file['name'];
$furl = "http://yourbucket.s3.amazonaws.com/".$fname;
echo "<a href=\"$furl\">$fname</a><br />";
}
This is the way implementing amazon S3 services. Remember only you need to amazon S3 Access and Secret keys.
Subscribe to:
Posts (Atom)