PHP code example of dawnangel / trovit-api

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

    

dawnangel / trovit-api example snippets


use DawnAngel\TrovitApi\TrovitApi;


use DawnAngel\TrovitApi\TrovitApi;


/**
 * TrovitApi Token:
 *
 * Get your Token by signing up in the following url with your details
 *
 * https://publishers.trovit.com/
 */
define('TROVIT_API_TOKEN', '<YOUR-TOKEN-ID>');

// Set TrovitApi Token
TrovitApi::setToken(TROVIT_API_TOKEN);

$apiParams = array(
    // Main params for the request
    'country' => 'es',
    'what'    => 'piso',
    'where'   => '',
    'type'    => '2', /* 1 -> Homes for sale, 2 -> Homes for rent */

    // Filter params for the request
    'region' => 'barcelona',
    'city'   => 'barcelona',

    // Params for API configuration
    'page'     => '1',
    'per_page' => '10',
    'order'    => 'relevance',
);

$ads = TrovitApi::doRequest(TrovitApi::VERTICAL_HOMES, $apiParams);