I'm using a class called Semelhantes
which will have 2 methods.
The features
takes 3 characteristics of the current property through id
.
resemblant
mounts a query that aims to bring real estate that looks like the current property and shows it as a kind of real estate related . p>
You can observe in the features
method at the end of it that I have already been able to store the attributes that I will use to call query using the resemblant
method. These attributes are stored.
I'm sending these attributes to the resemblant
method but when I try to call the information as it can be observed in the background of the code, instantiating the object and storing the result, I do not have the method return.
In this case, how do I get the return of the
resemblant()
method?
<?php
require("Acesso.class.php");
class Semelhantes extends Acesso
{
public function features($id)
{
$postFields = '{"fields":["Codigo","Categoria","Bairro","Cidade","ValorVenda","ValorLocacao","Dormitorios","Suites","Vagas","AreaTotal","AreaPrivativa","Caracteristicas","InfraEstrutura"]}';
$url = 'http://danielbo-rest.vistahost.com.br/'.$this->vsimoveis.'/'.$this->vsdetalhes.'?key=' . $this->vskey;
$url .= '&imovel='.$id.'&pesquisa=' . $postFields;
$ch = curl_init($url);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_HTTPHEADER , array( 'Accept: application/json' ) );
$result = curl_exec($ch);
$result = json_decode($result, true);
/**
* Paramentros para filtrar semelhança
* @var [type]
*/
$fcidade = str_replace(" ", "+", $result['Cidade']);
$fdorms = $result['Dormitorios'];
$fvalor = $result['ValorVenda'];
return array(
'cidade' => $fcidade,
'dorms' => $fdorms,
'valor' => $fvalor
);
}
public function resemblant()
{
$get = $this->features($id);
return $get['Cidade'];
}
}
/* Chamando as funções em outra parte do sistema */
$obj = new Semelhantes;
$features = $obj->features(2);
$similar = $obj->resemblant();