PHP code example of liviu-hariton / pinmeto-php-api

1. Go to this page and download the library: Download liviu-hariton/pinmeto-php-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

liviu-hariton / pinmeto-php-api example snippets




$pinmeto = new LHDev\PinMeToAPI\PinMeToAPI([
    'app_id' => 'PINMETO_APP_ID',
    'app_secret' => 'PINMETO_APP_SECRET',
    'account_id' => 'PINMETO_ACCOUNT_ID',
    'mode' => 'test' // or 'live' for production
]);

$locations = $pinmeto->getLocations();

$parameters = [
    'pagesize' => '2' // Number of locations that the request returns, default 100, max 250
    'next' => '569652a91151474860f5e173', // (string) Id of starting point to next page
    'before' => '569649b49c5ec8685e11175e', // (string) Id of starting point to previous page
];

$locations = $pinmeto->getLocations($parameters);

$store_id = 8;

$location = $pinmeto->getLocation($store_id);

$parameters = [
    'name' => 'Your store name',
    'storeId' => 'your_store_id',
    'address' => [
        'street' => 'Store address',
        'zip' => 'Zipcode',
        'city' => 'The City',
        'country' => 'The Country',
    ],
    'location' => [
        'lat' => 59.333755678571,
        'lon' => 18.056143908447,
    ],
];

$pinmeto->createLocation($parameters);

$pinmeto->createLocation($parameters, true);

$store_id = 8;

$parameters = [
    'name' => 'The new store name',
    'address' => [
        'street' => 'The new store address',
        'zip' => 'Some other zipcode',
        'city' => 'In some other city',
        'country' => 'In some other country',
    ],
];

$pinmeto->updateLocation($store_id, $parameters);

$metrics = $pinmeto->getMetrics(
    source: 'google', // the source can be either `facebook` or `google`
    from_date: '2024-01-01', // the format is `YYYY-MM-DD`
    to_date: '2024-03-31', // the format is `YYYY-MM-DD`
    fields: [
        'businessImpressionsDesktopMaps', 'businessImpressionsDesktopSearch'
    ] // All available fields are described here https://api.pinmeto.com/documentation/v3/
);

$metrics = $pinmeto->getMetrics(
    source: 'facebook', // the source can be either `facebook` or `google`
    from_date: '2024-01-01', // the format is `YYYY-MM-DD`
    to_date: '2024-03-31', // the format is `YYYY-MM-DD`
    store_id: 8
);

$keywords = $pinmeto->getKeywords(
    from_date: '2024-01', // the format is `YYYY-MM`
    to_date: '2024-03' // the format is `YYYY-MM`
);

$keywords = $pinmeto->getKeywords(
    from_date: '2024-01', // the format is `YYYY-MM`
    to_date: '2024-03', // the format is `YYYY-MM`
    store_id: 8
);

$ratings = $pinmeto->getRatings(
    source: 'google', // the source can be either `facebook` or `google`
    from_date: '2024-01-01', // the format is `YYYY-MM-DD`
    to_date: '2024-03-31' // the format is `YYYY-MM-DD`
);

$ratings = $pinmeto->getRatings(
    source: 'facebook', // the source can be either `facebook` or `google`
    from_date: '2024-01-01', // the format is `YYYY-MM-DD`
    to_date: '2024-03-31', // the format is `YYYY-MM-DD`
    store_id: 8
);

$category_networks = $pinmeto->getNetworkCategories(
    network: 'apple'
);