Showing posts with label Web Services. Show all posts
Showing posts with label Web Services. Show all posts

Friday, 27 May 2016

Upload Image from URL to S3 in Zend Framework

Upload Image from URL to S3 in Zend Framework


$imageURL = 'https://2.bp.blogspot.com/-AzIU8fSC-a8/V0f9UROmaJI/AAAAAAAAB5w/nu2dxJ8LJgQpRkTGjhsCLtmFbbt0XpT_ACLcB/s1600/Upload%2Bimage%2Bfrom%2BURL%2Bto%2BS3%2Bin%2BZend%2BFramework.png';
$extension = 'png';

$myAwsKey = 'AKIAP3APTHAC2DQLGJA'; //S3 AWS Key
$myAwsSecretKey = 'YJiKlVFERFuF/sadfzgS2jgj6z/Qhjkhsh'; //S3 Secret Key
$s3Media = 's3mediafolder'; //S3 Folder path

$s3 = new Zend_Service_Amazon_S3($myAwsKey, $myAwsSecretKey);
$uploadTo = 'clientProfileImages/thumb/205_test_push.png';

try {
    $s3->putFile($imageURL, "$s3Media/$uploadTo", array(
        Zend_Service_Amazon_S3::S3_ACL_HEADER => Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ,
        'x-amz-storage-class' => 'REDUCED_REDUNDANCY',
        'ContentType' => $extension
    ));
} catch (Exception $e) {
    echo $e->getMessage();
    die;
}
echo 'Image Uploaded Successfully in S3';

Friday, 8 May 2015

Youtube v3 API Sample API Requests and Response - Search Videos - Get Video Details

Youtube v3 API Sample API Requests and Response - Search Videos - Get Video Details


For youtube v3 API, you must need an API_KEY for video search, get video details, upload video and delete video etc.
In each request, you need to pass the APK_KEY to get the records, If you didn't pass the API_KEY, you will not get the response from youtube api.

In Youtube V2 API_KEY is not required, but its is compulsary for youtube V3 API.
google has stopped the youtube v2 API so you must use V3 API.

If you don't have API_KEY, please get the API Key from http://code.google.com/apis/console#access .
You must need google account for youtube v3 API.
Youtube v3 API Sample API Requests and Response - Search Video List - Get Video Details


Now, I am assuming you have valid API_KEY. if you have added referer while creating API, then you can use API_KEY for that domain only. Yeah you can add multiple domain for 1 key.
Suppose we have following API_KEY.
API_KEY: AIzaSyBqXp0Uo2ktJcMRpL_ZwF5inLTWZfsCYqY

Also you must enable the "YouTube Data API" from google console for the same key.

Get List of youtube Videos (By Default It will gives 4 videos)
https://www.googleapis.com/youtube/v3/search?part=snippet&key=AIzaSyBqXp0Uo2ktJcMRpL_ZwF5inLTWZfsCYqY


Get List of youtube videos (Search 40 videos)
https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=40&key=AIzaSyBqXp0Uo2ktJcMRpL_ZwF5inLTWZfsCYqY


Get List of youtube videos (Search 40 videos + having keyword "sports" )
https://www.googleapis.com/youtube/v3/search?part=snippet&q=sports&maxResults=40&key=AIzaSyBqXp0Uo2ktJcMRpL_ZwF5inLTWZfsCYqY


Get List of youtube videos( Search with 100km of 37.42307,-122.08427(lat/long)
https://www.googleapis.com/youtube/v3/search?locationRadius=100km&part=snippet&location=37.42307%2C-122.08427&type=video&key=AIzaSyBqXp0Uo2ktJcMRpL_ZwF5inLTWZfsCYqY


Get List of youtube videos (search videos which are tags with sports [videoCategoryId=17])
https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&videoCategoryId=17&key=AIzaSyBqXp0Uo2ktJcMRpL_ZwF5inLTWZfsCYqY


Response Format:
{"kind":"youtube#searchListResponse","etag":"\"tbWC5XrSXxe1WOAx6MK9z4hHSU8/okahf16vRr9O67w1AX2xksAkmDI\"","nextPageToken":"CAUQAA","pageInfo":{"totalResults":1000000,"resultsPerPage":5},"items":[{"kind":"youtube#searchResult","etag":"\"tbWC5XrSXxe1WOAx6MK9z4hHSU8/EIQjGNXfg22wA149MrmBxBM3QX4\"","id":{"kind":"youtube#video","videoId":"a2RA0vsZXf8"},"snippet":{"publishedAt":"2010-11-21T05:14:05.000Z","channelId":"UCplkk3J5wrEl0TNrthHjq4Q","title":"\"Just A Dream\" by Nelly - Sam Tsui & Christina Grimmie","description":"Check out our epic song with Coke Bottles! https://www.youtube.com/watch?v=ZzuRvzsNpTU Hope you guys like this duet between Christina Grimmie and Sam ...","thumbnails":{"default":{"url":"https://i.ytimg.com/vi/a2RA0vsZXf8/default.jpg"},"medium":{"url":"https://i.ytimg.com/vi/a2RA0vsZXf8/mqdefault.jpg"},"high":{"url":"https://i.ytimg.com/vi/a2RA0vsZXf8/hqdefault.jpg"}},"channelTitle":"KurtHugoSchneider","liveBroadcastContent":"none"}},{"kind":"youtube#searchResult","etag":"\"tbWC5XrSXxe1WOAx6MK9z4hHSU8/3bB0h6KJXx-TPbAqXKd5nADWGX0\"","id":{"kind":"youtube#video","videoId":"Ahha3Cqe_fk"},"snippet":{"publishedAt":"2011-11-11T18:37:24.000Z","channelId":"UC-8Q-hLdECwQmaWNwXitYDw","title":"Katy Perry - The One That Got Away","description":"Sometimes you promise someone forever but it doesn't work out that way. Watch Katy Perry and Diego Luna star in the sixth chapter of the “Teenage Dream” ...","thumbnails":{"default":{"url":"https://i.ytimg.com/vi/Ahha3Cqe_fk/default.jpg"},"medium":{"url":"https://i.ytimg.com/vi/Ahha3Cqe_fk/mqdefault.jpg"},"high":{"url":"https://i.ytimg.com/vi/Ahha3Cqe_fk/hqdefault.jpg"}},"channelTitle":"KatyPerryVEVO","liveBroadcastContent":"none"}},{"kind":"youtube#searchResult","etag":"\"tbWC5XrSXxe1WOAx6MK9z4hHSU8/VZLQn8wfLOJ60oe6Bced9ryD7Kg\"","id":{"kind":"youtube#video","videoId":"NV7xJ73_eeM"},"snippet":{"publishedAt":"2014-11-17T14:00:19.000Z","channelId":"UCMu5gPmKp5av0QCAajKTMhw","title":"Romeo and Juliet vs Bonnie and Clyde. Epic Rap Battles of History Season 4","description":"Download on iTunes ▻ http://bit.ly/1yN7aai ◅ Season 3 Autographed CDs available at ▻ http://shop.erb.fm ◅ Subscribe for more battles! http://bit.ly/1ElwJ40 ...","thumbnails":{"default":{"url":"https://i.ytimg.com/vi/NV7xJ73_eeM/default.jpg"},"medium":{"url":"https://i.ytimg.com/vi/NV7xJ73_eeM/mqdefault.jpg"},"high":{"url":"https://i.ytimg.com/vi/NV7xJ73_eeM/hqdefault.jpg"}},"channelTitle":"ERB","liveBroadcastContent":"none"}},{"kind":"youtube#searchResult","etag":"\"tbWC5XrSXxe1WOAx6MK9z4hHSU8/IN61vHPZ3FNoK9mme_Kf9E0U50c\"","id":{"kind":"youtube#video","videoId":"XjwZAa2EjKA"},"snippet":{"publishedAt":"2013-11-20T08:03:53.000Z","channelId":"UC-8Q-hLdECwQmaWNwXitYDw","title":"Katy Perry - Unconditionally (Official)","description":"Download \"Unconditionally\" from Katy Perry's 'PRISM': http://smarturl.it/PRISM Official video for Katy Perry's \"Unconditionally\" directed by Brent Bonacorso and ...","thumbnails":{"default":{"url":"https://i.ytimg.com/vi/XjwZAa2EjKA/default.jpg"},"medium":{"url":"https://i.ytimg.com/vi/XjwZAa2EjKA/mqdefault.jpg"},"high":{"url":"https://i.ytimg.com/vi/XjwZAa2EjKA/hqdefault.jpg"}},"channelTitle":"KatyPerryVEVO","liveBroadcastContent":"none"}},{"kind":"youtube#searchResult","etag":"\"tbWC5XrSXxe1WOAx6MK9z4hHSU8/gKZhz62FdXndZR7dJdi_PDTpe9U\"","id":{"kind":"youtube#video","videoId":"-kWHMH2kxXs"},"snippet":{"publishedAt":"2014-11-01T04:10:36.000Z","channelId":"UC8-Th83bH_thdKZDJCrn88g","title":"Wheel of Impressions with Kevin Spacey","description":"In this Halloween edition of Wheel of Impressions, Jimmy and Kevin take turns doing random celebrity impersonations, such as Christopher Walken talking ...","thumbnails":{"default":{"url":"https://i.ytimg.com/vi/-kWHMH2kxXs/default.jpg"},"medium":{"url":"https://i.ytimg.com/vi/-kWHMH2kxXs/mqdefault.jpg"},"high":{"url":"https://i.ytimg.com/vi/-kWHMH2kxXs/hqdefault.jpg"}},"channelTitle":"latenight","liveBroadcastContent":"none"}}]}



Get Youtube Videos by Channel
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCv7IjJclSgpfGUHnG171ovw&order=date&key=AIzaSyBpu8hgnXbkqFVWrAvwRUEz7T13ii3I7WM
Response Format:
{"kind":"youtube#searchListResponse","etag":"\"tbWC5XrSXxe1WOAx6MK9z4hHSU8/q7tdIBpMwbnE_LWyfCaBtuEXMes\"","nextPageToken":"CAUQAA","pageInfo":{"totalResults":296,"resultsPerPage":5},"items":[{"kind":"youtube#searchResult","etag":"\"tbWC5XrSXxe1WOAx6MK9z4hHSU8/kvgjXpyJJ1CVnWs7i6kI_3-X0go\"","id":{"kind":"youtube#video","videoId":"drsH-pNpxho"},"snippet":{"publishedAt":"2015-04-23T14:21:19.000Z","channelId":"UCv7IjJclSgpfGUHnG171ovw","title":"A4 Pain - Painkiller #7 by Fez","description":"Insane new episode from A4 Pain Player: A4 Pain https://www.youtube.com/channel/UCVSS_0NReZbN3phT1OSKseQ Editor: Fez TOS ...","thumbnails":{"default":{"url":"https://i.ytimg.com/vi/drsH-pNpxho/default.jpg"},"medium":{"url":"https://i.ytimg.com/vi/drsH-pNpxho/mqdefault.jpg"},"high":{"url":"https://i.ytimg.com/vi/drsH-pNpxho/hqdefault.jpg"}},"channelTitle":"TheApokalypse4","liveBroadcastContent":"none"}},{"kind":"youtube#searchResult","etag":"\"tbWC5XrSXxe1WOAx6MK9z4hHSU8/t-udHC0CmSmK9Ej_q8KQgfHpyAo\"","id":{"kind":"youtube#video","videoId":"4kq8pW3ML0M"},"snippet":{"publishedAt":"2015-04-09T20:09:46.000Z","channelId":"UCv7IjJclSgpfGUHnG171ovw","title":"Apokalypse4 Killcams of the week - Episode 12","description":"Yes this is a weekly, episode we're trying to bring out more content for you guys, this is a example. Hope you enjoy! [CLICK SHOW MORE] This weeks winners!","thumbnails":{"default":{"url":"https://i.ytimg.com/vi/4kq8pW3ML0M/default.jpg"},"medium":{"url":"https://i.ytimg.com/vi/4kq8pW3ML0M/mqdefault.jpg"},"high":{"url":"https://i.ytimg.com/vi/4kq8pW3ML0M/hqdefault.jpg"}},"channelTitle":"TheApokalypse4","liveBroadcastContent":"none"}},{"kind":"youtube#searchResult","etag":"\"tbWC5XrSXxe1WOAx6MK9z4hHSU8/2_P60vNc53lyEX63yeKf_wlXYSk\"","id":{"kind":"youtube#video","videoId":"faizfXUbCAc"},"snippet":{"publishedAt":"2015-04-05T15:35:47.000Z","channelId":"UCv7IjJclSgpfGUHnG171ovw","title":"Apokalypse4 Challenges you - Episode 13","description":"Winner's chosen on the 1st of May, submit your ONLINE responses through twitter to @tehapokalypse4 and follow us for further information, good luck guys!","thumbnails":{"default":{"url":"https://i.ytimg.com/vi/faizfXUbCAc/default.jpg"},"medium":{"url":"https://i.ytimg.com/vi/faizfXUbCAc/mqdefault.jpg"},"high":{"url":"https://i.ytimg.com/vi/faizfXUbCAc/hqdefault.jpg"}},"channelTitle":"TheApokalypse4","liveBroadcastContent":"none"}},{"kind":"youtube#searchResult","etag":"\"tbWC5XrSXxe1WOAx6MK9z4hHSU8/JVw8gcWNDBq6A0k3NzNYydX7n4A\"","id":{"kind":"youtube#video","videoId":"vHTMfV7sJVg"},"snippet":{"publishedAt":"2015-03-25T16:10:24.000Z","channelId":"UCv7IjJclSgpfGUHnG171ovw","title":"A4 Sponge: Cleaning up - Episode 1","description":"Insane feeder and editor collaborate and produce a insane episode, enjoy guys! Subscribe :) http://bit.ly/SubToA4 10000 Teamtage ...","thumbnails":{"default":{"url":"https://i.ytimg.com/vi/vHTMfV7sJVg/default.jpg"},"medium":{"url":"https://i.ytimg.com/vi/vHTMfV7sJVg/mqdefault.jpg"},"high":{"url":"https://i.ytimg.com/vi/vHTMfV7sJVg/hqdefault.jpg"}},"channelTitle":"TheApokalypse4","liveBroadcastContent":"none"}},{"kind":"youtube#searchResult","etag":"\"tbWC5XrSXxe1WOAx6MK9z4hHSU8/imFn4cchjV1Gbp9F2zt9P-FgIvU\"","id":{"kind":"youtube#video","videoId":"AAMk41lxuyA"},"snippet":{"publishedAt":"2015-03-09T19:47:21.000Z","channelId":"UCv7IjJclSgpfGUHnG171ovw","title":"TheFantastic4 - ft. Gibby, Frizzy, Metal, Pregs by Cayzuh","description":"the ex a4 players return one last time. gibby https://www.youtube.com/user/ByGibbio frizzy https://www.youtube.com/user/OnyxFreeZy metal ...","thumbnails":{"default":{"url":"https://i.ytimg.com/vi/AAMk41lxuyA/default.jpg"},"medium":{"url":"https://i.ytimg.com/vi/AAMk41lxuyA/mqdefault.jpg"},"high":{"url":"https://i.ytimg.com/vi/AAMk41lxuyA/hqdefault.jpg"}},"channelTitle":"TheApokalypse4","liveBroadcastContent":"none"}}]}




Get youtube video Detail
To get the youtube video detail, you must have an valid youtube video.
https://www.googleapis.com/youtube/v3/videos?id=a2RA0vsZXf8&part=snippet,statistics&key=AIzaSyBqXp0Uo2ktJcMRpL_ZwF5inLTWZfsCYqY
Response Format:
{"kind":"youtube#videoListResponse","etag":"\"tbWC5XrSXxe1WOAx6MK9z4hHSU8/5O69VO4RLDboG2ONvOiRwnoX77I\"","pageInfo":{"totalResults":1,"resultsPerPage":1},"items":[{"kind":"youtube#video","etag":"\"tbWC5XrSXxe1WOAx6MK9z4hHSU8/7xlJyY3lj1NCugehSg-sBnEM0YQ\"","id":"a2RA0vsZXf8","snippet":{"publishedAt":"2010-11-21T04:52:18.000Z","channelId":"UCplkk3J5wrEl0TNrthHjq4Q","title":"\"Just A Dream\" by Nelly - Sam Tsui & Christina Grimmie","description":"Check out our epic song with Coke Bottles! https://www.youtube.com/watch?v=ZzuRvzsNpTU\n\nHope you guys like this duet between Christina Grimmie and Sam Tsui on \"Just A Dream\" originally by Nelly!\n\nAnd if you don't know Christina, definitely check out her stuff and subscribe to her, because she rocks!!\nhttp://www.youtube.com/zeldaxlove64\n\nShare this on Facebook!  http://on.fb.me/JustADreamSamChristina\n\nWe just opened an online store with shirts, cd's and other cool stuff here:\nhttp://www.kurthugoschneider.com/store\n\n\n--------------\n\nLinks\n\nKURT SCHNEIDER\nFacebook- http://www.facebook.com/KurtHugoSchneider\nTwitter- http://www.twitter.com/KurtHSchneider\n\nSAM TSUI\nFacebook- http://www.facebook.com/SamTsuiMusic\nTwitter- http://www.twitter.com/SamuelTsui\n\n---------------\n\n'Just A Dream' (originally Performed By Nelly)\nWritten By: Cornell Haynes, Frank Romano, Jim Jonsin, James Scheffer, Richard Butler\nPublished By: Universal Music Publishing / EMI Music Publishing / Reach Global Inc.","thumbnails":{"default":{"url":"https://i.ytimg.com/vi/a2RA0vsZXf8/default.jpg","width":120,"height":90},"medium":{"url":"https://i.ytimg.com/vi/a2RA0vsZXf8/mqdefault.jpg","width":320,"height":180},"high":{"url":"https://i.ytimg.com/vi/a2RA0vsZXf8/hqdefault.jpg","width":480,"height":360},"standard":{"url":"https://i.ytimg.com/vi/a2RA0vsZXf8/sddefault.jpg","width":640,"height":480},"maxres":{"url":"https://i.ytimg.com/vi/a2RA0vsZXf8/maxresdefault.jpg","width":1280,"height":720}},"channelTitle":"Kurt Hugo Schneider","categoryId":"10","liveBroadcastContent":"none","localized":{"title":"\"Just A Dream\" by Nelly - Sam Tsui & Christina Grimmie","description":"Check out our epic song with Coke Bottles! https://www.youtube.com/watch?v=ZzuRvzsNpTU\n\nHope you guys like this duet between Christina Grimmie and Sam Tsui on \"Just A Dream\" originally by Nelly!\n\nAnd if you don't know Christina, definitely check out her stuff and subscribe to her, because she rocks!!\nhttp://www.youtube.com/zeldaxlove64\n\nShare this on Facebook!  http://on.fb.me/JustADreamSamChristina\n\nWe just opened an online store with shirts, cd's and other cool stuff here:\nhttp://www.kurthugoschneider.com/store\n\n\n--------------\n\nLinks\n\nKURT SCHNEIDER\nFacebook- http://www.facebook.com/KurtHugoSchneider\nTwitter- http://www.twitter.com/KurtHSchneider\n\nSAM TSUI\nFacebook- http://www.facebook.com/SamTsuiMusic\nTwitter- http://www.twitter.com/SamuelTsui\n\n---------------\n\n'Just A Dream' (originally Performed By Nelly)\nWritten By: Cornell Haynes, Frank Romano, Jim Jonsin, James Scheffer, Richard Butler\nPublished By: Universal Music Publishing / EMI Music Publishing / Reach Global Inc."}},"statistics":{"viewCount":"96352554","likeCount":"804825","dislikeCount":"8957","favoriteCount":"0","commentCount":"132350"}}]}





Friday, 17 April 2015

Web Services interview questions and answers for fresher

Web Services interview questions and answers for fresher


Question: What is web services?
It is method of communication between two devices Over the network. With use of web service we can send the request to another device and get the response.
For Example:
We want to know the current weather of "New York, USA".
For this we contact a web service which store the weather information.v Now, We just call
http://domain.com/know-weather-information/city/New York, USA [It is dummy, just for example]
(Here i have pass city name with country (It is request), they will return the city weather information(It is response))



Question: What are famous web service protocols?
In development world, we listen someone using SOAP another one using JSON and third one is using XML-RPC.
Many times, it confuse us that What is these and whey they are using different.
These all are webservice because they are using for exchanging the information.
These are web service but they using different protocol as per their requirement.

Following are some famous protocol used by developers.

  • XML-RPC - XML Remote Procedure Call
  • REST - Representational State Transfer
  • SOAP - outgrowth of XML-RPC, originally an acronym for Simple Object Access Protocol
  • JSON-RPC
  • JSON-WSP
  • UDDI -Universal Description, Discovery, and Integration
  • WPS - Web Processing Service
  • XINS Standard Calling Convention - HTTP parameters in (GET/POST/HEAD), POX out.




Question: What is XML-RPC?
XML-RPC is one of the protocols that use XML for messages between two server.v It is used to "Remote Procedure Calls" using XML.


Question: What is JSON-RPC?
JSON-RPC is one of the protocols that use JSON for messages between two server.
It is used to "Remote Procedure Calls" using JSON.
Format of JSON
{ "version": "1.1", "result": "done", "error": null, "id": "194521489" }



Question: What is JSON-WSP?
It is another term of Web Services only difference is that It uses JSON instead of XML for exchanging the information between two server.
JSON-WSP is simpler as compare to Web Service.



Question: What is SOAP?
SOAP is the protocol used in order to do transfers the data among computers.


Question: What is WSDL?
WDSL is that which describes the interface used in a specific service.



Question: What is Web API? A Web API is a Web services where emphasis has been moving to simpler representational state transfer (REST).
RESTful APIs do not require XML-based Web service protocols (SOAP and WSDL) to support their interfaces.
RESTful mostly use JSON, because it is fast and human readable.


Question: What is REST?
Representational State Transfer (REST) is a software architecture(protocol) style consisting of guidelines and practices for creating scalable web services.
It is simpler as compare to SOAP, WSDL based web services.
It is mostly used by Web pages using HTTP Request.


Question: What are differnet channels used for communication using web services?
HTTP/GET, HTTP/POST and SOAP


Question: What kind of security is needed for web services?
Web services should give response only to autorization calling server.
With each request, sender must send the authorization code and that must be validate by service provider.
We can use SSL for add extra security.



Question: Define Entrust Privacy Service?
It deals with security and confidentiality. This service encrypts data to ensure that only concerned parties can access the data.


Question: What is PKI?
It means Public-Key Infrastructure.


Question: What tools are used to test a SOAP and RESTFul services?
"SoapUI" for SOAP Web service and "Firefox poster plugin" for RESTFul services.


Question: What are distributed technologies?
The increasing ratio of distributed applications has raised demand for distributed technologies.



Question: What is the Web service protocol stack?
The Web service protocol stack is an evolving set of protocols used to define, discover, and implement Web services.


Sunday, 12 April 2015

Share count and Share URL of Facebook, Twitter, LinkedIn and Pinterest

Share count and Share URL of Facebook, Twitter, LinkedIn and Pininterest.

Share Count: There are different free api to get the share count of Facebook, Twitter, Linkedin and Pininterest. These number number of counts by all users.

Facebook Share (33)
http://graph.facebook.com/?id=http://www.web-technology-experts-notes.in

Response:
{
   "id": "http://www.web-technology-experts-notes.in",
   "shares": 33
}


Twitter Share (7)
https://share.yandex.ru/gpp.xml?url=http://www.web-technology-experts-notes.in

Response:
"20"


Linkedin Share (6)
 https://www.linkedin.com/countserv/count/share?format=json&url=http://www.web-technology-experts-notes.in
Response:
 {"count":6,"fCnt":"6","fCntPlusOne":"7","url":"http:\/\/www.web-technology-experts-notes.in"}


Pinterest Share (0)
 http://api.pinterest.com/v1/urls/count.json?callback=x&url=http://www.web-technology-experts-notes.in
Resonse:
 x({"url":"http://www.web-technology-experts-notes.in","count":0})





Share URL:Each Social Services (Facebook, Twitter, Linkedin and Pininterest), have its own sharing URL and its work on all global browsers.

Facebook Share (33)
http://www.facebook.com/sharer.php?u=http://www.web-technology-experts-notes.in


Twitter Share (7)
http://www.twitter.com/share?url=http://www.web-technology-experts-notes.in


Pinterest Share (0)
http://pinterest.com/pin/create/button/?media=http://www.web-technology-experts-notes.in


Linkedin Share (6)
http://www.linkedin.com/cws/share?url=http://www.web-technology-experts-notes.in




Share on Twitter with Custom Text
https://twitter.com/intent/tweet?text=this%20is%20custom%20text&url=web-technology-experts-notes.in


Share on Twitter with Custom Text and Via
https://twitter.com/intent/tweet?text=this%20is%20text&via=this_is_via&url=http://www.domain.com


Monday, 2 March 2015

Get Youtube video-details and comments using PHP

Get Youtube video-details and comments using PHP

How to get youtube video detail in Zend (Response in JSON)
$uTubeVideoCode ='ryJReIcMGOs';        
        $jsonData='';
        try{            
            $client = new Zend_Http_Client("http://gdata.youtube.com/feeds/api/videos/{$uTubeVideoCode}?v=2&alt=json");
            $response = $client->request('GET');
            $jsonData = $response->getBody();
        
        }  catch (Exception $e){
            echo "Error:".$e->getMessage();
            
        }    
        echo $jsonData;die;

Output:
{"version":"1.0","encoding":"UTF-8","entry":{"xmlns":"http://www.w3.org/2005/Atom","xmlns$gd":"http://schemas.google.com/g/2005","xmlns$yt":"http://gdata.youtube.com/schemas/2007","xmlns$media":"http://search.yahoo.com/mrss/","gd$etag":"W/\"CkACQn47eCp7I2A9XRRWEkU.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs"},"published":{"$t":"2015-02-22T05:17:46.000Z"},"updated":{"$t":"2015-03-02T07:19:23.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#video"},{"scheme":"http://gdata.youtube.com/schemas/2007/categories.cat","term":"People","label":"People & Blogs"}],"title":{"$t":"ICC Cricket World Cup 2015 India Vs South Africa Game 13 Highlights - IND VS SA 22/02/15 2015"},"content":{"type":"application/x-shockwave-flash","src":"http://www.youtube.com/v/ryJReIcMGOs?version=3&f=videos&app=youtube_gdata"},"link":[{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs&feature=youtube_gdata"},{"rel":"http://gdata.youtube.com/schemas/2007#video.related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/related?v=2"},{"rel":"http://gdata.youtube.com/schemas/2007#mobile","type":"text/html","href":"http://m.youtube.com/details?v=ryJReIcMGOs"},{"rel":"http://gdata.youtube.com/schemas/2007#uploader","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/users/ZBJOTQ3A-HYLRmpYm4hDeA?v=2"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"}],"author":[{"name":{"$t":"SGZ Cricket"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/SGZCricket"},"yt$userId":{"$t":"ZBJOTQ3A-HYLRmpYm4hDeA"}}],"yt$accessControl":[{"action":"comment","permission":"allowed"},{"action":"commentVote","permission":"allowed"},{"action":"videoRespond","permission":"moderated"},{"action":"rate","permission":"allowed"},{"action":"embed","permission":"allowed"},{"action":"list","permission":"allowed"},{"action":"autoPlay","permission":"allowed"},{"action":"syndicate","permission":"allowed"}],"gd$comments":{"gd$feedLink":{"rel":"http://gdata.youtube.com/schemas/2007#comments","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments?v=2","countHint":32}},"yt$hd":{},"media$group":{"media$category":[{"$t":"People","label":"People & Blogs","scheme":"http://gdata.youtube.com/schemas/2007/categories.cat"}],"media$content":[{"url":"http://www.youtube.com/v/ryJReIcMGOs?version=3&f=videos&app=youtube_gdata","type":"application/x-shockwave-flash","medium":"video","isDefault":"true","expression":"full","duration":1544,"yt$format":5},{"url":"rtsp://r4---sn-a5m7zu7s.c.youtube.com/CiILENy73wIaGQnrGAyHeFEirxMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp","type":"video/3gpp","medium":"video","expression":"full","duration":1544,"yt$format":1},{"url":"rtsp://r4---sn-a5m7zu7s.c.youtube.com/CiILENy73wIaGQnrGAyHeFEirxMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp","type":"video/3gpp","medium":"video","expression":"full","duration":1544,"yt$format":6}],"media$credit":[{"$t":"sgzcricket","role":"uploader","scheme":"urn:youtube","yt$display":"SGZ Cricket","yt$type":"partner"}],"media$description":{"$t":"ICC Cricket World Cup 2015 India Vs South Africa Game 13 Highlights - IND VS SA 22/02/15 2015\n\nICC Cricket World Cup 2015 India Vs Pakistan Game 4 Highlights - IND VS PAK 15/2/15\n\nICC Cricket World Cup 2015 India Vs South Africa\nICC Cricket World Cup 2015 India Vs South Africa 2/22/15\nICC Cricket World Cup 2015 India Vs South Africa 22 February 2015\n\nSubscribe For More Videos : https://www.youtube.com/user/SGZCricket\nGoogle + : https://plus.google.com/u/0/b/1093080...\n\nExtra Tag : ICC Cricket World Cup 2015 India Vs South Africa 2/22/15 ICC Cricket World Cup 2015 India Vs South Africa 2/22/15 2015 ICC Cricket World Cup 2015 India Vs South Africa 2/22/15 Full Match ICC Cricket World Cup 2015 India Vs South Africa 2/22/15 Highlights ICC Cricket World Cup 2015 India Vs South Africa 02/22/15 Full Results","type":"plain"},"media$keywords":{},"media$license":{"$t":"youtube","type":"text/html","href":"http://www.youtube.com/t/terms"},"media$player":{"url":"http://www.youtube.com/watch?v=ryJReIcMGOs&feature=youtube_gdata_player"},"media$thumbnail":[{"url":"http://i.ytimg.com/vi/ryJReIcMGOs/default.jpg","height":90,"width":120,"time":"00:12:52","yt$name":"default"},{"url":"http://i.ytimg.com/vi/ryJReIcMGOs/mqdefault.jpg","height":180,"width":320,"yt$name":"mqdefault"},{"url":"http://i.ytimg.com/vi/ryJReIcMGOs/hqdefault.jpg","height":360,"width":480,"yt$name":"hqdefault"},{"url":"http://i.ytimg.com/vi/ryJReIcMGOs/sddefault.jpg","height":480,"width":640,"yt$name":"sddefault"},{"url":"http://i.ytimg.com/vi/ryJReIcMGOs/1.jpg","height":90,"width":120,"time":"00:06:26","yt$name":"start"},{"url":"http://i.ytimg.com/vi/ryJReIcMGOs/2.jpg","height":90,"width":120,"time":"00:12:52","yt$name":"middle"},{"url":"http://i.ytimg.com/vi/ryJReIcMGOs/3.jpg","height":90,"width":120,"time":"00:19:18","yt$name":"end"}],"media$title":{"$t":"ICC Cricket World Cup 2015 India Vs South Africa Game 13 Highlights - IND VS SA 22/02/15 2015","type":"plain"},"yt$aspectRatio":{"$t":"widescreen"},"yt$duration":{"seconds":"1544"},"yt$uploaded":{"$t":"2015-02-22T05:17:46.000Z"},"yt$uploaderId":{"$t":"UCZBJOTQ3A-HYLRmpYm4hDeA"},"yt$videoid":{"$t":"ryJReIcMGOs"}},"gd$rating":{"average":1.6350245,"max":5,"min":1,"numRaters":1222,"rel":"http://schemas.google.com/g/2005#overall"},"yt$statistics":{"favoriteCount":"0","viewCount":"397572"},"yt$rating":{"numDislikes":"1028","numLikes":"194"}}}


How to get youtube video comments in Zend(Response in JSON)
        $uTubeVideoCode ='ryJReIcMGOs';        
        $jsonData='';
        try{            
            $client = new Zend_Http_Client("http://gdata.youtube.com/feeds/api/videos/{$uTubeVideoCode}/comments?v=2&alt=json");
            $response = $client->request('GET');
            $jsonData = $response->getBody();
        
        }  catch (Exception $e){
            echo "Error:".$e->getMessage();
            
        } 
echo $jsonData;  

Output:

{"version":"1.0","encoding":"UTF-8","feed":{"xmlns":"http://www.w3.org/2005/Atom","xmlns$gd":"http://schemas.google.com/g/2005","xmlns$openSearch":"http://a9.com/-/spec/opensearch/1.1/","xmlns$yt":"http://gdata.youtube.com/schemas/2007","gd$etag":"W/\"CUYAQ3kzfCp7I2A9XRRWEkU.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comments"},"updated":{"$t":"2015-03-02T07:59:02.784Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"logo":{"$t":"http://www.gstatic.com/youtube/img/logo.png"},"link":[{"rel":"http://schemas.google.com/g/2005#feed","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments?v=2"},{"rel":"http://schemas.google.com/g/2005#batch","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/batch?v=2"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments?alt=json&max-results=25&v=2"},{"rel":"service","type":"application/atomsvc+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments?alt=atom-service&v=2"}],"author":[{"name":{"$t":"YouTube"},"uri":{"$t":"http://www.youtube.com/"}}],"generator":{"$t":"YouTube data API","version":"2.1","uri":"http://gdata.youtube.com"},"openSearch$totalResults":{"$t":21},"openSearch$itemsPerPage":{"$t":25},"entry":[{"gd$etag":"W/\"AkQDRX47eCp7I2A9XRRXFk0.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z13yynd4ssvaubg4n04cf3sytyaijddqwkc0k"},"published":{"$t":"2015-02-22T12:32:54.000Z"},"updated":{"$t":"2015-02-22T12:32:54.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":"woooooooooooooooow\ufeff"},"content":{"$t":"woooooooooooooooow\ufeff"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z13yynd4ssvaubg4n04cf3sytyaijddqwkc0k?v=2"}],"author":[{"name":{"$t":"Rujul Deshpande"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/lIx3u1pJAyoxSMT2YAoEjg"},"yt$userId":{"$t":"lIx3u1pJAyoxSMT2YAoEjg"}}],"yt$channelId":{"$t":"UClIx3u1pJAyoxSMT2YAoEjg"},"yt$googlePlusUserId":{"$t":"102896019321279244010"},"yt$replyCount":{"$t":1},"yt$videoid":{"$t":"ryJReIcMGOs"}},{"gd$etag":"W/\"C04NRH47eCp7I2A9XRRXFko.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z12oh5xbdqmmtdgii04ce33x5xz1xz3yrag"},"published":{"$t":"2015-02-23T06:13:15.000Z"},"updated":{"$t":"2015-02-23T06:13:15.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":"can someone tell me ..."},"content":{"$t":"can someone tell me which game is this???\ufeff"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z12oh5xbdqmmtdgii04ce33x5xz1xz3yrag?v=2"}],"author":[{"name":{"$t":"sajan sebastian"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/xzNmG-CxBF8AkMEtmtaCOw"},"yt$userId":{"$t":"xzNmG-CxBF8AkMEtmtaCOw"}}],"yt$channelId":{"$t":"UCxzNmG-CxBF8AkMEtmtaCOw"},"yt$googlePlusUserId":{"$t":"116346366931114012924"},"yt$replyCount":{"$t":1},"yt$videoid":{"$t":"ryJReIcMGOs"}},{"gd$etag":"W/\"D0IDQn47eCp7I2A9XRRXF0s.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z13hexfyzsigv5fd322qez1xupbbyvnee"},"published":{"$t":"2015-02-24T08:12:53.000Z"},"updated":{"$t":"2015-02-24T08:12:53.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":"SGZ cricket..... ..."},"content":{"$t":"SGZ cricket..... grow up...\ufeff"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z13hexfyzsigv5fd322qez1xupbbyvnee?v=2"}],"author":[{"name":{"$t":"Roshan More"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/mZCY2FMCPkNn8RdNlPf0ww"},"yt$userId":{"$t":"mZCY2FMCPkNn8RdNlPf0ww"}}],"yt$channelId":{"$t":"UCmZCY2FMCPkNn8RdNlPf0ww"},"yt$googlePlusUserId":{"$t":"101759163693693799937"},"yt$replyCount":{"$t":0},"yt$videoid":{"$t":"ryJReIcMGOs"}},{"gd$etag":"W/\"AkYFQX47eCp7I2A9XRRWEE8.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z12yf5libtipzjki104cenrhvobhyftj2lk0k"},"published":{"$t":"2015-02-27T09:08:30.000Z"},"updated":{"$t":"2015-02-27T09:08:30.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":"In this World cup ..."},"content":{"$t":"In this World cup each and every matches are interesting but only match \nschesule is not perfect ....\ufeff"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z12yf5libtipzjki104cenrhvobhyftj2lk0k?v=2"}],"author":[{"name":{"$t":"Nikunj Goletar"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/Shu6BVmlTRMgS_HtaB9yzQ"},"yt$userId":{"$t":"Shu6BVmlTRMgS_HtaB9yzQ"}}],"yt$channelId":{"$t":"UCShu6BVmlTRMgS_HtaB9yzQ"},"yt$googlePlusUserId":{"$t":"108529240828297091468"},"yt$replyCount":{"$t":0},"yt$videoid":{"$t":"ryJReIcMGOs"}},{"gd$etag":"W/\"DUYGQX47eCp7I2A9XRRXFk0.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z13juluxpmepddgrr04cjb2gnvvfhndyzp00k"},"published":{"$t":"2015-02-22T12:12:00.000Z"},"updated":{"$t":"2015-02-22T12:12:00.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":"may i know the name ..."},"content":{"$t":"may i know the name of the game\ufeff"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z13juluxpmepddgrr04cjb2gnvvfhndyzp00k?v=2"}],"author":[{"name":{"$t":"Gopinath V"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/tamilanxxx"},"yt$userId":{"$t":"9Qu8ceBfkJ9txoCO3k3ENw"}}],"yt$channelId":{"$t":"UC9Qu8ceBfkJ9txoCO3k3ENw"},"yt$googlePlusUserId":{"$t":"115360643619137243306"},"yt$replyCount":{"$t":0},"yt$videoid":{"$t":"ryJReIcMGOs"}},{"gd$etag":"W/\"CUMBRH47eCp7I2A9XRRWEE4.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z13oyzgwvlroujxzu04cjjryjpyzwnmil54"},"published":{"$t":"2015-02-27T10:37:35.000Z"},"updated":{"$t":"2015-02-27T10:37:35.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":"woooooooooooooooow\ufeff"},"content":{"$t":"woooooooooooooooow\ufeff"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z13oyzgwvlroujxzu04cjjryjpyzwnmil54?v=2"}],"author":[{"name":{"$t":"Husnain shah"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/__NO_YOUTUBE_ACCOUNT__"},"yt$userId":{"$t":"__NO_YOUTUBE_ACCOUNT__"}}],"yt$channelId":{"$t":"UC__NO_YOUTUBE_ACCOUNT__"},"yt$googlePlusUserId":{"$t":"113607893143655172508"},"yt$replyCount":{"$t":0},"yt$videoid":{"$t":"ryJReIcMGOs"}},{"gd$etag":"W/\"C0MDSX47eCp7I2A9XRRWEko.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z13mfpo41z3jebh2v22ggr5xtuqvyn2eo"},"published":{"$t":"2015-03-02T04:44:38.000Z"},"updated":{"$t":"2015-03-02T04:44:38.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":"congrates\ufeff"},"content":{"$t":"congrates\ufeff"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z13mfpo41z3jebh2v22ggr5xtuqvyn2eo?v=2"}],"author":[{"name":{"$t":"Amol Awasthi"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/THBPSc-ik_m440Djkhe0ew"},"yt$userId":{"$t":"THBPSc-ik_m440Djkhe0ew"}}],"yt$channelId":{"$t":"UCTHBPSc-ik_m440Djkhe0ew"},"yt$googlePlusUserId":{"$t":"118383318670254507980"},"yt$replyCount":{"$t":0},"yt$videoid":{"$t":"ryJReIcMGOs"}},{"gd$etag":"W/\"DUMERn47eCp7I2A9XRRWEE8.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z13bs11qzp2kjvpsj22ecvjb5ouvh1ilb"},"published":{"$t":"2015-02-27T08:56:47.000Z"},"updated":{"$t":"2015-02-27T08:56:47.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":"haha you are the ..."},"content":{"$t":"haha you are the world fellow ever\ufeff"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z13bs11qzp2kjvpsj22ecvjb5ouvh1ilb?v=2"}],"author":[{"name":{"$t":"nani98663"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/nani98663"},"yt$userId":{"$t":"_oMue9jTfGX75AQUxeceiw"}}],"yt$channelId":{"$t":"UC_oMue9jTfGX75AQUxeceiw"},"yt$googlePlusUserId":{"$t":"115292334965355156920"},"yt$replyCount":{"$t":0},"yt$videoid":{"$t":"ryJReIcMGOs"}},{"gd$etag":"W/\"DkYMQX47eCp7I2A9XRRXGEQ.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z12th1ditzvedbxsp22kxxlzeuucfbrcw"},"published":{"$t":"2015-02-25T19:56:20.000Z"},"updated":{"$t":"2015-02-25T19:56:20.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":"seriously grow up ..."},"content":{"$t":"seriously grow up man\ufeff"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z12th1ditzvedbxsp22kxxlzeuucfbrcw?v=2"}],"author":[{"name":{"$t":"Ishan Shinde"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/5nefuBa-wS5dlh9mthIsQQ"},"yt$userId":{"$t":"5nefuBa-wS5dlh9mthIsQQ"}}],"yt$channelId":{"$t":"UC5nefuBa-wS5dlh9mthIsQQ"},"yt$googlePlusUserId":{"$t":"115372824146721655757"},"yt$replyCount":{"$t":0},"yt$videoid":{"$t":"ryJReIcMGOs"}},{"gd$etag":"W/\"A0YNSX47eCp7I2A9XRRXF00.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z13pgp5yirr0wtxik04civwpimrcerapvek"},"published":{"$t":"2015-02-23T16:33:18.000Z"},"updated":{"$t":"2015-02-23T16:33:18.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":"hell no.... how ..."},"content":{"$t":"hell no.... how interesting....lol\ufeff"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z13pgp5yirr0wtxik04civwpimrcerapvek?v=2"}],"author":[{"name":{"$t":"Darshan Jain"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/TmQQ8VHwustduwHXiLowWg"},"yt$userId":{"$t":"TmQQ8VHwustduwHXiLowWg"}}],"yt$channelId":{"$t":"UCTmQQ8VHwustduwHXiLowWg"},"yt$googlePlusUserId":{"$t":"116504884552174068967"},"yt$replyCount":{"$t":0},"yt$videoid":{"$t":"ryJReIcMGOs"}},{"gd$etag":"W/\"DEMER347eCp7I2A9XRRXGEQ.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z13utrm4zyjgwd20n22tfnzqzvuehh5lc"},"published":{"$t":"2015-02-25T20:33:26.000Z"},"updated":{"$t":"2015-02-25T20:33:26.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":"Grow up friend\ufeff"},"content":{"$t":"Grow up friend\ufeff"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z13utrm4zyjgwd20n22tfnzqzvuehh5lc?v=2"}],"author":[{"name":{"$t":"abhijit kulkarni"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/abhijit0727"},"yt$userId":{"$t":"NWvmyhNFs1B8ljeaQXES1A"}}],"yt$channelId":{"$t":"UCNWvmyhNFs1B8ljeaQXES1A"},"yt$googlePlusUserId":{"$t":"105890333904958496583"},"yt$replyCount":{"$t":0},"yt$videoid":{"$t":"ryJReIcMGOs"}},{"gd$etag":"W/\"D04DQ347eCp7I2A9XRRXF08.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z12wxpvrlofxc5s0w23ownp4doe4wrx4r04"},"published":{"$t":"2015-02-23T21:12:52.000Z"},"updated":{"$t":"2015-02-23T21:12:52.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":"wow the crowd sucks ..."},"content":{"$t":"wow the crowd sucks in this game\ufeff"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z12wxpvrlofxc5s0w23ownp4doe4wrx4r04?v=2"}],"author":[{"name":{"$t":"Mehul Shukla"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/mehulshukla04"},"yt$userId":{"$t":"xu8mQo6LHTGfYAG-j7mNug"}}],"yt$channelId":{"$t":"UCxu8mQo6LHTGfYAG-j7mNug"},"yt$googlePlusUserId":{"$t":"105925848190989770553"},"yt$replyCount":{"$t":0},"yt$videoid":{"$t":"ryJReIcMGOs"}},{"gd$etag":"W/\"A08BQ347eCp7I2A9XRRXF0g.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z12wf3irhvr5sbbjq04ccx4rtz24yveq25k"},"published":{"$t":"2015-02-24T06:37:32.000Z"},"updated":{"$t":"2015-02-24T06:37:32.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":"can u tell the name ..."},"content":{"$t":"can u tell the name of the game plss??????\ufeff"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z12wf3irhvr5sbbjq04ccx4rtz24yveq25k?v=2"}],"author":[{"name":{"$t":"nikhil kulal"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/HZacepyCMUAS5AzaKPImwA"},"yt$userId":{"$t":"HZacepyCMUAS5AzaKPImwA"}}],"yt$channelId":{"$t":"UCHZacepyCMUAS5AzaKPImwA"},"yt$googlePlusUserId":{"$t":"103284323473829074041"},"yt$replyCount":{"$t":0},"yt$videoid":{"$t":"ryJReIcMGOs"}},{"gd$etag":"W/\"D04FRX47eCp7I2A9XRRXFkQ.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z125irwomybbexbvj23dwxqgbtbdyf0nc"},"published":{"$t":"2015-02-23T12:51:54.000Z"},"updated":{"$t":"2015-02-23T12:51:54.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":"woow vata game\ufeff"},"content":{"$t":"woow vata game\ufeff"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z125irwomybbexbvj23dwxqgbtbdyf0nc?v=2"}],"author":[{"name":{"$t":"pradeep appu"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/7j-ZZrFk6CylNMihVsV1vQ"},"yt$userId":{"$t":"7j-ZZrFk6CylNMihVsV1vQ"}}],"yt$channelId":{"$t":"UC7j-ZZrFk6CylNMihVsV1vQ"},"yt$googlePlusUserId":{"$t":"116605829416262485807"},"yt$replyCount":{"$t":0},"yt$videoid":{"$t":"ryJReIcMGOs"}},{"gd$etag":"W/\"AkUNQn47eCp7I2A9XRRWEEo.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z121c51wuquciznns230yxnorkb2x34ai04"},"published":{"$t":"2015-02-27T23:04:53.000Z"},"updated":{"$t":"2015-02-27T23:04:53.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":"superhero..indian . ..."},"content":{"$t":"superhero..indian ..jai ho\ufeff"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z121c51wuquciznns230yxnorkb2x34ai04?v=2"}],"author":[{"name":{"$t":"chupbhosari terabaap"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/80XYP3ohlonHxFjyJxMg9w"},"yt$userId":{"$t":"80XYP3ohlonHxFjyJxMg9w"}}],"yt$channelId":{"$t":"UC80XYP3ohlonHxFjyJxMg9w"},"yt$googlePlusUserId":{"$t":"107946096902915779887"},"yt$replyCount":{"$t":0},"yt$videoid":{"$t":"ryJReIcMGOs"}},{"gd$etag":"W/\"AkEGR347eCp7I2A9XRRXFkQ.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z13scpvijxithh0lm23dxpa5vkzsw50a304"},"published":{"$t":"2015-02-23T13:37:06.000Z"},"updated":{"$t":"2015-02-23T13:37:06.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":"good\ufeff"},"content":{"$t":"good\ufeff"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z13scpvijxithh0lm23dxpa5vkzsw50a304?v=2"}],"author":[{"name":{"$t":"Maha Linagam"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/mali4991"},"yt$userId":{"$t":"4NyMEDI3PVTVEM9Fga-K5Q"}}],"yt$channelId":{"$t":"UC4NyMEDI3PVTVEM9Fga-K5Q"},"yt$googlePlusUserId":{"$t":"103431499595674948971"},"yt$replyCount":{"$t":0},"yt$videoid":{"$t":"ryJReIcMGOs"}},{"gd$etag":"W/\"DUAFRH47eCp7I2A9XRRXF00.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z12nxdegiqzecxljo04chvn4dkzmuvwgdr00k"},"published":{"$t":"2015-02-23T16:08:35.000Z"},"updated":{"$t":"2015-02-23T16:08:35.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":"dafuq is this???\ufeff"},"content":{"$t":"dafuq is this???\ufeff"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z12nxdegiqzecxljo04chvn4dkzmuvwgdr00k?v=2"}],"author":[{"name":{"$t":"Katherine May"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/Vvt17yrrm4cwZT5HakoHFw"},"yt$userId":{"$t":"Vvt17yrrm4cwZT5HakoHFw"}}],"yt$channelId":{"$t":"UCVvt17yrrm4cwZT5HakoHFw"},"yt$googlePlusUserId":{"$t":"105114308315934876966"},"yt$replyCount":{"$t":0},"yt$videoid":{"$t":"ryJReIcMGOs"}},{"gd$etag":"W/\"CkIDSH47eCp7I2A9XRRXGUg.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z12detpbmozjc5dms23csd4rkyvgsvnok04"},"published":{"$t":"2015-02-26T11:36:19.000Z"},"updated":{"$t":"2015-02-26T11:36:19.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":""},"content":{"$t":""},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z12detpbmozjc5dms23csd4rkyvgsvnok04?v=2"}],"author":[{"name":{"$t":"Ashokkumar T"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/3kFgr6i5Ugr7aIYEZvU-Iw"},"yt$userId":{"$t":"3kFgr6i5Ugr7aIYEZvU-Iw"}}],"yt$channelId":{"$t":"UC3kFgr6i5Ugr7aIYEZvU-Iw"},"yt$googlePlusUserId":{"$t":"101665337513199560569"},"yt$replyCount":{"$t":0},"yt$videoid":{"$t":"ryJReIcMGOs"}},{"gd$etag":"W/\"C0ANQn47eCp7I2A9XRRWEUQ.\"","id":{"$t":"tag:youtube.com,2008:video:ryJReIcMGOs:comment:z12uy31y3weyelzop04cgnoyloukhpvrcrs0k"},"published":{"$t":"2015-03-01T06:36:33.000Z"},"updated":{"$t":"2015-03-01T06:36:33.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://gdata.youtube.com/schemas/2007#comment"}],"title":{"$t":"New inspiring song ..."},"content":{"$t":"New inspiring song for team india to win the world cup\nhttps://www.youtube.com/watch?v=vxNf1m2SiY0\ufeff"},"link":[{"rel":"related","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs?v=2"},{"rel":"alternate","type":"text/html","href":"http://www.youtube.com/watch?v=ryJReIcMGOs"},{"rel":"self","type":"application/atom+xml","href":"http://gdata.youtube.com/feeds/api/videos/ryJReIcMGOs/comments/z12uy31y3weyelzop04cgnoyloukhpvrcrs0k?v=2"}],"author":[{"name":{"$t":"Kumar K"},"uri":{"$t":"http://gdata.youtube.com/feeds/api/users/X0WlKnTMzGDgVDZ4TmWujQ"},"yt$userId":{"$t":"X0WlKnTMzGDgVDZ4TmWujQ"}}],"yt$channelId":{"$t":"UCX0WlKnTMzGDgVDZ4TmWujQ"},"yt$googlePlusUserId":{"$t":"116638980038801195984"},"yt$replyCount":{"$t":0},"yt$videoid":{"$t":"ryJReIcMGOs"}}]}}


Best Related Posts are Following:
1. How to send Email in Zend Framework - HTML Email
2. Send Email from Gmail SMTP using Zend Framework
3. Google trends api php - How to get hot trends
4. Multiple column ordering in Zend Framework
5. Current time zone for a city- Free API
6. Zend Gdata Youtube API - Search Video - View Video Detail
7. Download Videos from Amazon S3 - PHP
8. How to set Cron in Zend Framework
9. Zend Cache Tutorial - Zend Framework 1.12
10. Zend Framework Interview Questions and Answers for Experienced

Tuesday, 13 January 2015

How to create webservice in php with SOAP Technology

How to create webservice in php with SOAP Technology

Here we will learn how to create a SOAP based web service and know how to use a web service created with SOAP.

For creating webservice you must know the basics of following.
What is Web Services
Web Services is Interaction between two machines over a network. It use SOAP, REST, and XML-RPC as a means of communication. A Web service always needs a network for its operation.
Know Difference between WebService and API


What is SOAP
SOAP stands for Simple Object Access Protocol. SOAP is an XML-based protocol for exchanging information between two computers over the internet. It enables you to Remote Procedure Calls (RPC) transported via HTTP.
More About SOAP


Now Follow the following Simple Steps:
1. Donwnload the library File from http://sourceforge.net/projects/nusoap/.
2. Unzip/extract the downloaded zip file.
3. Copy the "lib" folder from unziped folder and past in root folder of your project.
   Suppose your project is myproject:
   Project Location: D:\wamp\www\myproject
   Library Location: D:\wamp\www\myproject\lib
4.Create two files soapServer.php and soapClient.php into myproject folder.
5. Add Following code in soapServer.php
/* Include library file **/ 
require_once ('lib/nusoap.php'); 

/** create the object of SoapServer **/
$serverObj = new soap_server;
$namespace = 'http://localhost/myproject/soapServer.php?wsdl';
$serverObj->configureWSDL('get_messageString', $namespace); 

//register a function that works on server 
$serverObj->register('get_message'); 

// create the function 
function get_message($your_name) 
{ 
return "Hello {$your_name}!"; 
} 

if ( !isset( $HTTP_RAW_POST_DATA ) ){
  $HTTP_RAW_POST_DATA =file_get_contents('php://input' );
} 
// create HTTP listener 
$serverObj->service($HTTP_RAW_POST_DATA);


6. Add Following code in soapClient.php
require_once ('lib/nusoap.php'); 
//Give it value at parameter 
$param = array( 'your_name' => 'Web Technology Experts Notes');

try{
      //Create object that referer a web services 
    $clientObj = new soapclient('http://localhost/myproject/soapServer.php'); 
    //Call a function at server and send parameters too 
    $response = $clientObj->call('get_message',$param); 
    //Process result 
    if($clientObj->fault){ 
      echo "FAULT: Code: ($clientObj->faultcode)"; 
      echo "String: ".$clientObj->faultstring; 
    }else { 
      echo $response; 
      } 
}catch(Exception $e){
    echo $e->getMessage();
}   

7. soapClient.php will use as client whereas soapServer.php will be used as server.

Wednesday, 24 December 2014

Facebook comments Integration in website

Facebook comments box for website



Add Following code in your website, Facebook comment will start working.





<div id="fb-root"> </div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <div class="fb-comments" data-colorscheme="light" data-href="http://www.web-technology-experts-notes.in/2014/12/facebook-comments-box-for-website.html" data-numposts="5" width="700"> </div>
See Demo:






You can manage following Options in Facebook Comment Box.
1. data-colorscheme: Color scheme used by the plugin. Can be "light" or "dark".
Option: light|dark

2. data-href: This is comment page URL, you can also add dynamic page URL. Add Website Address bar URL like http://dev.georama.loc/comment.php

3. data-numposts: Total no of comments wants to display at the time of page load.
default:5

4. width: Total widths of facebook comments box
default:550

Monday, 24 November 2014

How to setup your twitter App?

How to setup your twitter App?

Setup your App in Twitter.com

  1. Login to https://twitter.com (If Not registered, please register first)
  2. Add Mobile Number and verify (https://twitter.com/settings/devices)
  3. Go to Manage Apps page (i.e https://apps.twitter.com/)
  4. Create a New App
  5. Fill all required info
  6. In "What type of access does your application need" set "Read and write"
  7. Save API Key and API secret (Consumer key and Consumer Secret key)


Follow PHP Work from Below sites(I have test this, Its working)