Exemplo n.º 1
0
 public static function callRest($aConfig, $aData)
 {
     try {
         $sRawDataSign = '';
         foreach ($aData as $k => $v) {
             if ($k != 'checksum' && $k != 'addInfo' && $k != 'description') {
                 $sRawDataSign .= $v;
             }
         }
         $sign = sha1($sRawDataSign . $aConfig['key']);
         $aData['checksum'] = $sign;
         $request = new RestRequest($aConfig['url'], 'POST');
         $request->buildPostBody($aData);
         $request->execute();
         $http_code = $request->getHTTPCode();
         $rs->return = array();
         $rs->return['httpcode'] = $http_code;
         if ($http_code == '200') {
             $result = json_decode($request->getResponseBody(), true);
             $rs->return = $result;
             $rs->return['httpcode'] = $http_code;
         } else {
             $rs->return['message'] = $request->getResponseBody();
         }
         return $rs;
     } catch (Exception $fault) {
         throw $fault;
     }
 }
Exemplo n.º 2
0
  * @param   (string)    $image      Image name to search for
  * @param   (string)    $path       Directory path to search for image
  * @return  (string,boolean)        Returns path of image if found, false if not found
  */
 public static function find_image_path($image, $path = "", $depth = 0)
 {
     # If no path supplied, get current working directory
     if ($path == "") {
Exemplo n.º 3
0
<?php

require_once ".././include/initialize.php";
$request = new RestRequest('http://api.magazinuldecase.ro');
$request->setPath('/imobile.json');
$request->setVerb('put');
$data = array('key' => '2HVO01c20rHj0lB60jI50dwB', 'tip_oferta' => 'vanzare', 'categorie_imobil' => 'apartament', 'zone_id' => '145', 'orase_id' => '1', 'strada_imobil' => 'Basarabia', 'camere_imobil' => '2', 'bai_imobil' => '1', 'suprafata_imobil' => '56.00', 'pret_imobil' => '60000', 'pret_tva' => 'cu_tva', 'pret_negociabil' => '1', 'afiseaza_pmp' => '1', 'incalzire_imobil' => 'centrala_zona', 'etaj_imobil' => '8', 'etajDin_imobil' => 'P+10', 'an_constructie_imobil' => '1984', 'terase_balcoane' => '1', 'compartimentare' => 'decomandat', 'info_imobil' => 'Confort 1, decomandat, , apometre, boxa la subsol, debara, interfon, lift, curent, apa curenta, canalizare, gaze, telefon; Vecinatati: magazine, RATB, parc, lac, supermarket, spital; cod SP01049', 'Ylat' => '44.43383274527434', 'Ylong' => '26.155072202682515', 'telefon_proprietar' => '44932', 'email' => '*****@*****.**', 'id_intern' => 'SP01049');
$request->buildPostBody($data);
$request->execute();
$response = $request->getResponseBody();
print_r($response);