user12897186
user12897186

Reputation:

Checking GeoLite2 have IP Adress

I use this repository.

But, I don't know how to check if that data exists.

Help me.

All codes error.

Reader::connect()->city($_SERVER["REMOTE_ADDR"]);
Reader::connect()->city($_SERVER["REMOTE_ADDR"])->mostSpecificSubdivision->name;
Reader::connect()->city($request->ip());
Reader::connect()->city($request->ip())->mostSpecificSubdivision->name;

In the first place, an error has occurred at the time of the city function.

Upvotes: 0

Views: 76

Answers (1)

A.A Noman
A.A Noman

Reputation: 5270

check your ip exist use isset like below

if(isset($request->ip())){
    //Your code here
}

Upvotes: 0

Related Questions