Merhaba Arkadaşlar

Basit bir log sistemi yapmaya çalışıyorum. Verileri ekrana yazdırıp ardından db'ye kaydetmek istiyorum. Yazdırma olayında problem yok fakat yazdırılan verileri db'ye kayıt etmede problem yaşıyorum.

Kod :

<html>

    <title>LOG-V.0.1</title>

</html>
<?php
.
.
.
function ipAdresiAl($ip = null){
 
    if($ip == null){
        if(getenv("HTTP_CLIENT_IP")) {
            $ip = getenv("HTTP_CLIENT_IP");
        } elseif(getenv("HTTP_X_FORWARDED_FOR")) {
            $ip = getenv("HTTP_X_FORWARDED_FOR");
            if (strstr($ip, ',')) {
                $tmp = explode (',', $ip);
                $ip = trim($tmp[0]);
            }
        } else {
            $ip = getenv("REMOTE_ADDR");
        }
    }
 
    $json = file_get_contents("http://site.com/{$ip}");
    $detaylar = json_decode($json);
    return $detaylar;
}
 
$ip = ipAdresiAl('');
 
echo '
    <strong>Ip Adresi :</strong> '. $ip->ip . '<br/>
    <strong>Hostname :</strong> '. $ip->hostname . '<br/>
    <strong>City :</strong> '. $ip->city . '<br/>
    <strong>Region :</strong> '. $ip->region . '<br/>
    <strong>Country :</strong> '. $ip->country . '<br/>
    <strong>Location :</strong> '. $ip->loc . '<br/>
    <strong>Organization :</strong> '. $ip->org . '<br/>
    <strong>Postal :</strong> '. $ip->postal . '<br/>
';
 
.
.
.


?>
Bu php dosyasını çalıştırdığımda error_log içerisinde aşağıdaki satır oluşmaktadır.

---
[29-Apr-2017 21:08:21 UTC] PHP Catchable fatal error:  Object of class stdClass could not be converted to string in /home/test/public_html/test/test.php on line 54
---
Yukarıdaki kod'un örnek çıktısı aşağıdaki gibidir

Ip Adresi : 8.8.8.8
Hostname : No Hostname
City : Istanbul
Region : Istanbul
Country : TR
Location : 11.0214,21.9684
Organization : AS47524 Turksat Uydu Haberlesme ve Kablo TV Isletme A.S.
Postal :
Host : google.com
User-Agent : Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0
Accept : text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language : tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding : gzip, deflate
Cookie : PHPSESSID=n8rl8d7gnt0hu52nlkvaeffh94
Connection : keep-alive
Upgrade-Insecure-Requests : 1
Cache-Control : max-age=0
Kısaca yukarıdaki çıktıda bulunan sonuçları db'ye yazdırmak istiyorum naptıysam bir türlü hatayı çözemedim.

Şimdiden Yarımcı Olan Arkadaşlara Teşekkürler.
İyi Forumlar.