Google APIs Client Library PHP Get Blog Info by URL

Hi Guys,

So, as I mentioned on previous post References, I've been using Google APIs Client Library for PHP to comunicate with the Google (Blogger) services. So let's start playing with the library.

Get Blog Info by URL

Take a look this codes:

$client = new \Google_Client();
$client->setApplicationName('ANY_APP_NAME');
$client->setDeveloperKey('YOUR_DEVELOPER_KEY');

$service = new \Google_Service_Blogger($client);
$blog = $service->blogs->getByUrl('BLOG_URL');

echo json_encode($blog->toSimpleObject());

The result is something like this:

{
    "status": "ok",
    "data": {
        "description": "Tutorial php framework, yii framework, yii2 framework, laravel framework, codeigniter framework, ci framework, pemrograman berorientasi objek, pbo, object oriented programming, pop gratis",
        "id": "6612500226451156285",
        "kind": "blogger#blog",
        "name": "YII SOLUTIONS",
        "published": "2019-03-08T17:29:16-08:00",
        "selfLink": "https://www.googleapis.com/blogger/v3/blogs/6612500226451156285",
        "updated": "2020-03-21T01:43:13-07:00",
        "url": "http://yiisolution.blogspot.com/",
        "posts": {
            "selfLink": "https://www.googleapis.com/blogger/v3/blogs/6612500226451156285/posts",
            "totalItems": 29
        },
        "pages": {
            "selfLink": "https://www.googleapis.com/blogger/v3/blogs/6612500226451156285/pages",
            "totalItems": 9
        },
        "locale": {
            "country": "",
            "language": "en",
            "variant": ""
        }
    }
}

Simple, right?
See you guys by next chance :)

ps: Do you survive #corona2020? Hope you survive, anywhere.

Comments

Popular posts from this blog

penyebab gempa bumi Gempa bumi penyebab gunung berapi tsunami

Gempa Hari Ini 30 Juni 2023 Jumat wib terjadi pukul gempa terkini kekuatannya manado gempabumi bmkg dirasakan