geocoder-php / GeocoderLaravel

Geocoder service provider for Laravel
http://geocoder-php.org/GeocoderLaravel/
MIT License
704 stars 102 forks source link

Laravel error Trying to get property 'result' of non-object #151

Closed startcrowds closed 5 years ago

startcrowds commented 5 years ago

public function get_address() { $fields = array( "jsonrpc" => '2.0', "method" => 'createAddressForToken', "params" => array('password'), "id" => '1', ); $fields = json_encode($fields); $headers = array( 'Content-Type: application/json' );

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, APIURL);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
    $result = curl_exec($ch);
    curl_close($ch);
    $response=json_decode($result);        
    if(isset($response->error->code))
    {
        return $address=0;  
    }
    else
    {           
        return $address=$response->result;
    }
}

}

startcrowds commented 5 years ago

Error is in the line return $address=$response->result;

mikebronner commented 5 years ago

@startcrowds Could you elaborate on what you are referencing? Where is this code? What is the issue? This doesn't seem to fit with how this plugin is to be used. Please refer to the readme as to how to implement address geocoding.

startcrowds commented 5 years ago

This code queries a smart contract associated with an ethereum address, but it gives me a value of null and does not recognize it as an object

mikebronner commented 5 years ago

I'm not sure what this has to do with this package?

startcrowds commented 5 years ago

Ok Bro thanks!