PHP code example of fw4 / omnicasa-cre

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

    

fw4 / omnicasa-cre example snippets


use OmnicasaCRE\Omnicasa;
use OmnicasaCRE\Enums\Language;

$api = new Omnicasa('your-secret-key', Language::EN);
$properties = $api->getProperties();

$api->getProperties($parameters); // Get basic property list
$api->getProperties($parameters, true); // Get detailed property list
$api->getProperty($id, $parameters);
$api->addPropertyVisit($id, $real_client_ip);
$api->getGoals($parameters);
$api->getPropertyTypes($parameters);
$api->getCities($parameters);
$api->registerPerson($parameters);
$api->contactOnMe($parameters);

$properties = $api->getProperties();

// Traversing over the response takes care of pagination in the background
foreach ($properties as $property) {
    echo $property->id . PHP_EOL;
}

$page_index = 2;
$items_per_page = 20;

$properties = $api->getProperties();
$page = $properties->page($page_index, $items_per_page);

echo 'Showing ' . $page->count() . ' items out of ' . $page->getTotalCount() . PHP_EOL;
echo 'Page ' . ($page->getPage() + 1) . ' of ' . $page->getPageCount() . PHP_EOL;
foreach ($page as $property) {
    echo $property->id . PHP_EOL;
}