NAVNavbar
Logo
cURL php NodeJS Python cSharp

Get Google Events SERP Advanced Results by id

Instead of ‘login’ and ‘password’ use your credentials from https://app.dataforseo.com/api-dashboard

<?php
// You can download this file from here https://cdn.dataforseo.com/v3/examples/php/php_RestClient.zip
require('RestClient.php');
$api_url = 'https://api.dataforseo.com/';
try {
    // Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-dashboard
    $client = new RestClient($api_url, null, 'login', 'password');
} catch (RestClientException $e) {
    echo "n";
    print "HTTP code: {$e->getHttpCode()}n";
    print "Error code: {$e->getCode()}n";
    print "Message: {$e->getMessage()}n";
    print  $e->getTraceAsString();
    echo "n";
    exit();
}
try {
    $result = array();
    // #1 - using this method you can get a list of completed tasks
    // GET /v3/serp/google/events/tasks_ready
    // in addition to '{{low_se_name}}' and '{{low_se_type}}' you can also set other search engine and type parameters
    // the full list of possible parameters is available in documentation
    $tasks_ready = $client->get('/v3/serp/google/events/tasks_ready');
    // you can find the full list of the response codes here https://docs.dataforseo.com/v3/appendix/errors
    if (isset($tasks_ready['status_code']) AND $tasks_ready['status_code'] === 20000) {
        foreach ($tasks_ready['tasks'] as $task) {
            if (isset($task['result'])) {
                foreach ($task['result'] as $task_ready) {
                    // #2 - using this method you can get results of each completed task
                    // GET /v3/serp/google/events/task_get/advanced/$id
                    if (isset($task_ready['endpoint_advanced'])) {
                        $result[] = $client->get($task_ready['endpoint_advanced']);
                    }
                    // #3 - another way to get the task results by id
                    // GET /v3/serp/google/events/task_get/advanced/$id
                    /*
                    if (isset($task_ready['id'])) {
                        $result[] = $client->get('/v3/serp/google/events/task_get/advanced/' . $task_ready['id']);
                    }
                    */
                }
            }
        }
    }
    print_r($result);
    // do something with result
} catch (RestClientException $e) {
    echo "n";
    print "HTTP code: {$e->getHttpCode()}n";
    print "Error code: {$e->getCode()}n";
    print "Message: {$e->getMessage()}n";
    print  $e->getTraceAsString();
    echo "n";
}
$client = null;
?>

The above command returns JSON structured like this:

{
    "version": "0.1.20221214",
    "status_code": 20000,
    "status_message": "Ok.",
    "time": "0.0915 sec.",
    "cost": 0,
    "tasks_count": 1,
    "tasks_error": 0,
    "tasks": [
        {
            "id": "01131917-1535-0139-0000-0cd97591018c",
            "status_code": 20000,
            "status_message": "Ok.",
            "time": "0.0518 sec.",
            "cost": 0,
            "result_count": 1,
            "path": [
                "v3",
                "serp",
                "google",
                "events",
                "task_get",
                "advanced"
            ],
            "data": {
                "api": "serp",
                "function": "task_get",
                "se": "google",
                "se_type": "events",
                "keyword": "concerts",
                "location_name": "Los Angeles,California,United States",
                "date_range": "today",
                "device": "desktop",
                "os": "windows"
            },
            "result": [
                {
                    "keyword": "concerts",
                    "type": "events",
                    "se_domain": "google.com",
                    "location_code": 1013962,
                    "language_code": "en",
                    "check_url": "https://www.google.com/search?q=concerts&ibp=htl;events&gl=US&uule=w+CAIQIFISCRPaJ9xdx8KAEfQIRiVv3y_i&hl=en#htivrt=events&htichips=date:today",
                    "datetime": "2023-01-13 17:18:01 +00:00",
                    "spell": null,
                    "item_types": [
                        "event_item"
                    ],
                    "se_results_count": 0,
                    "items_count": 10,
                    "items": [
                        {
                            "type": "event_item",
                            "rank_group": 1,
                            "rank_absolute": 1,
                            "position": "right",
                            "xpath": "/div[1]/div[1]/div[1]/ul[1]/li[1]",
                            "title": "The Temptations",
                            "description": "The Temptations, often referred to as “American Music Royalty,” are world-renowned superstars of entertainment, revered for their phenomenal catalog of music and prolific career. The group... Read more on Where Music Meets The Soul",
                            "url": "https://wheremusicmeetsthesoul.com/events/the-temptations-beverly-hills-jan-2023/",
                            "image_url": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSvNQG19cHGsymkHKJGD3Sdw92u0HaRzTkohZjOTz8J-hpJyfxDGGPWr_geifM&s=10",
                            "event_dates": {
                                "start_datetime": null,
                                "end_datetime": "2023-01-13T00:00:00+00:00",
                                "displayed_dates": "Fri, Jan 13, 8 – 10 PM"
                            },
                            "location_info": {
                                "name": "Saban Theatre",
                                "address": "8440 Wilshire Blvd, Beverly Hills, CA",
                                "url": "https://www.google.com/maps/place//data=!4m2!3m1!1s0x80c2b9460c894db5:0xc07adc32e08ea673?sa=X&hl=en&gl=US",
                                "cid": "13869640113514784371",
                                "feature_id": "0x80c2b9460c894db5:0xc07adc32e08ea673"
                            },
                            "information_and_tickets": [
                                {
                                    "type": "information_and_tickets_element",
                                    "title": "Axs.com",
                                    "description": "TICKETS",
                                    "url": "https://www.axs.com/events/436377/the-temptations-tickets",
                                    "domain": "www.axs.com"
                                },
                                {
                                    "type": "information_and_tickets_element",
                                    "title": "Where Music Meets The Soul",
                                    "description": "MORE INFO",
                                    "url": "https://wheremusicmeetsthesoul.com/events/the-temptations-beverly-hills-jan-2023/",
                                    "domain": "wheremusicmeetsthesoul.com"
                                },
                                {
                                    "type": "information_and_tickets_element",
                                    "title": "Discover Los Angeles",
                                    "description": "MORE INFO",
                                    "url": "https://www.discoverlosangeles.com/event/2023/01/13/the-temptations",
                                    "domain": "www.discoverlosangeles.com"
                                },
                                {
                                    "type": "information_and_tickets_element",
                                    "title": "Community calendar | KTLA",
                                    "description": "MORE INFO",
                                    "url": "https://ktla.com/community-calendar-ktla/?/calendar/&EventID=5602520#!/details/The-Temptations/10470572/2023-01-13T20",
                                    "domain": "ktla.com"
                                },
                                {
                                    "type": "information_and_tickets_element",
                                    "title": "Expedia",
                                    "description": "MORE INFO",
                                    "url": "https://www.expedia.com/event-tickets/event/the-temptations-tickets-saban-theatre-beverly-hills-ca-1-13-2023-5180903",
                                    "domain": "www.expedia.com"
                                }
                            ]
                        },
                        {
                            "type": "event_item",
                            "rank_group": 2,
                            "rank_absolute": 2,
                            "position": "right",
                            "xpath": "/div[1]/div[1]/div[1]/ul[1]/li[2]",
                            "title": "Jack White",
                            "description": "Jack White FRI, Jan 13, 2023 @ 7:00 PM The Belasco, Los Angeles, CA Read more on Live Nation",
                            "url": "https://www.livenation.com/event/vvG10Z9x97ySQG/jack-white",
                            "image_url": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSrpjaXNOdLC5-klrSl_YNO5C7UUw-dBc8XL3K6CiGqXu4k7bnPcR42sHtveQ&s=10",
                            "event_dates": {
                                "start_datetime": null,
                                "end_datetime": "2023-01-13T00:00:00+00:00",
                                "displayed_dates": "Fri, Jan 13, 7 – 11 PM"
                            },
                            "location_info": {
                                "name": "The Belasco",
                                "address": "1050 S Hill St, Los Angeles, CA",
                                "url": "https://www.google.com/maps/place//data=!4m2!3m1!1s0x80c2c7c9657d7e4f:0xd785c19a71b23a97?sa=X&hl=en&gl=US",
                                "cid": "15530031759133653655",
                                "feature_id": "0x80c2c7c9657d7e4f:0xd785c19a71b23a97"
                            },
                            "information_and_tickets": [
                                {
                                    "type": "information_and_tickets_element",
                                    "title": "Stereoboard.com",
                                    "description": "TICKETS",
                                    "url": "https://www.stereoboard.com/jack-white-tickets/los-angeles",
                                    "domain": "www.stereoboard.com"
                                },
                                {
                                    "type": "information_and_tickets_element",
                                    "title": "Discover Los Angeles",
                                    "description": "MORE INFO",
                                    "url": "https://www.discoverlosangeles.com/event/2023/01/13/jack-white",
                                    "domain": "www.discoverlosangeles.com"
                                },
                                {
                                    "type": "information_and_tickets_element",
                                    "title": "Live Nation",
                                    "description": "MORE INFO",
                                    "url": "https://www.livenation.com/event/vvG10Z9x97ySQG/jack-white",
                                    "domain": "www.livenation.com"
                                },
                                {
                                    "type": "information_and_tickets_element",
                                    "title": "Discotech",
                                    "description": "MORE INFO",
                                    "url": "https://app.discotech.me/events/37328749-jack-white-at-belasco",
                                    "domain": "app.discotech.me"
                                }
                            ]
                        },
                        {
                            "type": "event_item",
                            "rank_group": 3,
                            "rank_absolute": 3,
                            "position": "right",
                            "xpath": "/div[1]/div[1]/div[1]/ul[1]/li[3]",
                            "title": "MTT Conducts Mahler 9",
                            "description": "(Nearby Event: Concerts & Music) Where: Walt Disney Concert Hall, 111 South Grand Avenue, Los-Angeles, California, United States, 90012 Read more on Desert Palms Hotel & Suites",
                            "url": "https://www.desertpalmshotel.com/events/los-angeles/los-angeles-philharmonic-and-michael-tilson-thomas-0",
                            "image_url": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTxbXX2LeF5n1X8rDNB41l1gZQLnS97Ux285Gj4iTN_mw&s=10",
                            "event_dates": {
                                "start_datetime": "2023-01-13T00:00:00+00:00",
                                "end_datetime": "2023-01-14T00:00:00+00:00",
                                "displayed_dates": "Fri, Jan 13, 8 PM – Sat, Jan 14, 12 AM"
                            },
                            "location_info": {
                                "name": "Walt Disney Concert Hall",
                                "address": "111 S Grand Ave, Los Angeles, CA",
                                "url": "https://www.google.com/maps/place//data=!4m2!3m1!1s0x80c2c64d9fbb11d3:0xb3728c2c3bff31b0?sa=X&hl=en&gl=US",
                                "cid": "12930551601747145136",
                                "feature_id": "0x80c2c64d9fbb11d3:0xb3728c2c3bff31b0"
                            },
                            "information_and_tickets": [
                                {
                                    "type": "information_and_tickets_element",
                                    "title": "Concertarchives.org",
                                    "description": "TICKETS",
                                    "url": "https://www.concertarchives.org/concerts/los-angeles-philharmonic-e2d66035-b041-422e-8a02-14eff9a0772f#ticket-section",
                                    "domain": "www.concertarchives.org"
                                },
                                {
                                    "type": "information_and_tickets_element",
                                    "title": "Feefreeticket.com",
                                    "description": "TICKETS",
                                    "url": "https://www.feefreeticket.com/los-angeles-philharmonic-mtt-conducts-mahler-9-walt-disney-concert-hall/5062686",
                                    "domain": "www.feefreeticket.com"
                                },
                                {
                                    "type": "information_and_tickets_element",
                                    "title": "Stagefronttickets.com",
                                    "description": "TICKETS",
                                    "url": "https://www.stagefronttickets.com/events/3890465/los-angeles-philharmonic-mahler-tickets-walt-disney-concert-hall",
                                    "domain": "www.stagefronttickets.com"
                                },
                                {
                                    "type": "information_and_tickets_element",
                                    "title": "Desert Palms Hotel & Suites",
                                    "description": "MORE INFO",
                                    "url": "https://www.desertpalmshotel.com/events/los-angeles/los-angeles-philharmonic-and-michael-tilson-thomas-0",
                                    "domain": "www.desertpalmshotel.com"
                                },
                                {
                                    "type": "information_and_tickets_element",
                                    "title": "Visit West Hollywood",
                                    "description": "MORE INFO",
                                    "url": "https://www.visitwesthollywood.com/events/mtt-conducts-mahler-9-01-13-2023/",
                                    "domain": "www.visitwesthollywood.com"
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ]
}

Description of the fields for sending a request:

Field name Type Description
id string task identifier
unique task identifier in our system in the UUID format
you will be able to use it within 30 days to request the results of the task at any time


‌‌As a response of the API server, you will receive JSON-encoded data containing a tasks array with the information specific to the set tasks.

You can also get all available SERP features and possible extra elements by making a request to the following Sandbox URL:
https://sandbox.dataforseo.com/v3/serp/google/events/task_get/advanced/00000000-0000-0000-0000-000000000000
The response will include all available items in the Google Events SERP Advanced endpoint with the fields containing dummy data.
You won’t be charged for using Sandbox endpoints.

Description of the fields in the results array:

Field name Type Description
version string the current version of the API
status_code integer general status code
you can find the full list of the response codes here
Note: we strongly recommend designing a necessary system for handling related exceptional or error conditions
status_message string general informational message
you can find the full list of general informational messages here
time string execution time, seconds
cost float total tasks cost, USD
tasks_count integer the number of tasks in the tasksarray
tasks_error integer the number of tasks in the tasks array returned with an error
tasks array array of tasks
        id string unique task identifier in our system
in the UUID format
        status_code integer status code of the task
generated by DataForSEO; can be within the following range: 10000-60000
you can find the full list of the response codes here
        status_message string informational message of the task
you can find the full list of general informational messages here
        time string execution time, seconds
        cost float cost of the task, USD
        result_count integer number of elements in the result array
        path array URL path
        data object contains the same parameters that you specified in the POST request
        result array array of results
            keyword string keyword received in a POST array
keyword is returned with decoded %## (plus symbol ‘+’ will be decoded to a space character)
            type string search engine type in a POST array
            se_domain string search engine domain in a POST array
            location_code integer location code in a POST array
            language_code string language code
in this case, the value will be null
            check_url string direct URL to search engine results
            datetime string date and time when the result was received
in the UTC format: “yyyy-mm-dd hh-mm-ss +00:00”
example:
2019-11-15 12:57:46 +00:00
            spell object autocorrection of the search engine
if the search engine provided results for a keyword that was corrected, we will specify the keyword corrected by the search engine and the type of autocorrection
                keyword string keyword obtained as a result of search engine autocorrection
the results will be provided for the corrected keyword
                type string type of autocorrection
possible values:
did_you_mean, showing_results_for, no_results_found_for, including_results_for
            item_types array types of search results found in SERP
possible item types:
event_item
            se_results_count integer total number of results in SERP
in this case, the value will be 0
this search engine does not indicate the total number of results
            items_count integer the number of results returned in the items array
            items array items in SERP
            ‘event_item’ element in SERP
                type string type of element = ‘event_item’
                rank_group integer group rank in SERP
position within a group of elements with identical type values
positions of elements with different type values are omitted from rank_group
                rank_absolute integer absolute rank in SERP
absolute position among all the elements in SERP
                position string the alignment of the element in SERP
can take the following values:
left, right
                xpath string the XPath of the element
                title string title of the result in SERP
                description string description of the results element in SERP
                url string relevant URL
                image_url string URL of the image featured in the element
                event_dates object dates when the event takes place
if there are none, equals null
                    start_datetime string date and time when the event starts
if time zone is specified in the event, value will be returned in the UTC format:
“yyyy-mm-ddThh-mm-ss+00:00”
example:
2019-11-15T12:57:46+00:00
if time zone is not specified in the event, unspecified local time will be returned in the following format:
“yyyy-mm-ddThh-mm-ss”
example:
2019-11-15T12:57:46
                    end_datetime string date and time when the event ends
if time zone is specified in the event, value will be returned in the UTC format:
“yyyy-mm-ddThh-mm-ss+00:00”
example:
2019-11-15T12:57:46+00:00
if time zone is not specified in the event, unspecified local time will be returned in the following format:
“yyyy-mm-ddThh-mm-ss”
example:
2019-11-15T12:57:46
                    displayed_dates string date or date range as it is displayed in SERP
                location_info object information about the event’s venue
if there is none, equals null
                    name string name of the event’s venue
                    address string address of the event’s venue
                    url string URL to the event’s venue on google maps
                    cid string google-defined client id
unique id of a local establishment;
can be used with Google Reviews API to get a full list of reviews
                    feature_id string the unique identifier of the element in SERP
                information_and_tickets array additional information and ticket purchase options
if there is none, equals null
                        type string type of element = ‘information_and_tickets_element’
                        title string title of the element
                        description string description of the element
                        url string relevant URL
                        domain string domain in SERP

‌‌