0

Скрипт,собирающий статистику о посещениях сайта.Нужно вывести город и страну.Вместо этого в переменной $entry_line выдает array в таблице

    <?php
    function countryCityFromIP($ipAddr)
    {
    $ip = $_SERVER['REMOTE_ADDR'];


    $url = "http://api.ipinfodb.com/v3/ip-city/?key=c28b69b0c7cb56b5d876f24a22529b43f9371d72bbf860e56f80a859dea1b878&ip=$ip&form
    at=json";
    $d = file_get_contents($url);
    return json_decode($d , true);
    }
    $ip=countryCityFromIP($_REQUEST['ip']);
    $uri = $_SERVER['REQUEST_URI'];
    $dtime = date("F j, Y, g:i:s ");
    if($uri == "/ip.php"){
    $uri = "Зашел на сайт";
    }
    echo "<p style='color:red;'>".$ip['cityName']."</p>";
    echo "<p style='color:red;'>".$ip['countryName']."</p>";
    $entry_line = "
    <center><table><tr><th><b>$dtime </b></th><th><b>$ip['cityName']</b>
    </th>
    <th><b> $uri </b></th></tr></table></center>
    ";

    $fp = fopen("admin/admin.php", "a");
    fputs($fp, $entry_line);
    fclose($fp);
    ?>

1 ответ 1

0
$entry_line = "
<center><table><tr><th><b>$dtime </b></th><th><b>".$ip['cityName']."</b>
</th>
<th><b> $uri </b></th></tr></table></center>
";

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.