GithubHelp home page GithubHelp logo

Get data from public ip about laravel HOT 5 CLOSED

ipinfo avatar ipinfo commented on June 14, 2024
Get data from public ip

from laravel.

Comments (5)

marcemarin avatar marcemarin commented on June 14, 2024 1

But in the docs you do "$ip_address = '216.239.36.21';", i need to get that ip from the client request

from laravel.

UmanShahzad avatar UmanShahzad commented on June 14, 2024

@marcemarin If you want your public IP, this is the wrong package - use the PHP package at https://github.com/ipinfo/php.

This package is meant to retrieve details automatically for the client IP of the request. It will not make requests for any random IP you wish, which is what the underlying PHP package is for.

In this case the "client IP" was "172.18.0.1". If an outside user had the IP "1.2.3.4" and hit your Laravel endpoint, you'd see that IP instead.

from laravel.

coderholic avatar coderholic commented on June 14, 2024

172.18.0.1 is a bogon - it isn't the client IP (assuming the request was made over the public internet). @marcemarin do you have a loadbalancer or something? Or are you making requests to a dev server over a local network or something?

from laravel.

marcemarin avatar marcemarin commented on June 14, 2024

Thanks a lot guys, it works perfect

from laravel.

UmanShahzad avatar UmanShahzad commented on June 14, 2024

It's definitely a matter of making requests to a dev server over the local network.

@marcemarin To elaborate a bit more, you need to use the PHP package and input the IP you want to look up within your request handler. This Laravel package is a simple wrapper over the PHP package and is dedicated to one thing: automating the lookup of the client IP.

from laravel.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.