Exemplo n.º 1
0
    /**
     * Load Location information for Ip address specified in Id
     *
     * @anonym
     * @service geoip read
     * @param $fields
     */
    public function load(Gpf_Rpc_Params $params) {
        $data = new Gpf_Rpc_Data($params);

        $location = new GeoIp_Location();
        $location->setIpString($data->getId());
        $location->load();

        $data->setValue('ip', $location->getIpString());
        $data->setValue('countryCode', $location->getCountryCode());
        $data->setValue('countryName', $location->getCountryName());
        $data->setValue('city', $location->getCity());
        $data->setValue('areaCode', $location->getAreaCode());
        $data->setValue('dmaCode', $location->getDmaCode());
        $data->setValue('latitude', $location->getLatitude());
        $data->setValue('longitude', $location->getLongitude());
        $data->setValue('postalCode', $location->getPostalCode());
        $data->setValue('region', $location->getRegion());

        return $data;
    }