PHP code example of ingatlancom / apiclient

1. Go to this page and download the library: Download ingatlancom/apiclient 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/ */

    

ingatlancom / apiclient example snippets


$driver = new Stash\Driver\FileSystem(['path' => '/tmp/ingatlancom/']);
$pool = new Stash\Pool($driver);

$apiUrl = 'https://api.ingatlan.com';
$apiClient = new \IngatlanCom\ApiClient\ApiClient($apiUrl, $pool);

$apiClient->login('username', 'password');

$ad = [
    'ownId'           => 'x149395',
    'listingType'     => 1,
    'propertyType'    => 1,
    'propertySubtype' => 2,
    'priceHuf'        => 17500000
     ...
];
$apiClient->putAd($ad);

$ad = $apiClient->getAd('x149395');

$apiClient->deleteAd('x149395');

$ids = $apiClient->getAdIds();

$ads = [
    'hirdetes1',
    'hirdetes2'
    ...
];
$ids = $apiClient->syncAds($ads);

use IngatlanCom\ApiClient\Enum\PhotoLabelEnum;

$photos = [
    [
        'ownId'    => 'kep1',
        'order'    => 1,
        'title'    => 'Képfelirat 1',
        'location' => 'http://lorempixel.com/800/600/city/1/',
        'labelId'  => PhotoLabelEnum::KORNYEK
    ],
    [
        'ownId'    => 'kep2',
        'order'    => 2,
        'title'    => 'Képfelirat 2',
        'location' => 'http://lorempixel.com/800/600/city/2/',
    ]
];
$ids = $apiClient->syncPhotos(
    'x149395',
    $photos,
    $forceImageDataUpdate,
    $uploadedPhotos,
    $paralellDownload
);

$photoData = [
    'ownId'    => 'kep3',
    'order'    => 3,
    'title'    => 'Képfelirat 3',
    'labelId'  => null,
    'imageData' => file_get_contents('kepem.jpg')
];
$ids = $apiClient->putPhoto('x149395', $photoData);

$ids = $apiClient->putPhotosMulti('x149395', $photos);

$ids = $apiClient->deletePhoto('x149395', 'kep123');

$photoIds = ['kep1', 'kep2'];
$ids = $apiClient->deletePhotosMulti('x149395', $photoIds);

$photos = $apiClient->getPhotos('x149395');

$photoOrder = ['kep1', 'kep2', 'kep3'];
$ids = $apiClient->putPhotoOrder('x149395', $photoOrder);

$isOk = $apiClient->checkApiStatus();
bash
php composer.phar install