Coder Social home page Coder Social logo

Request: New Map feature to be added about php HOT 5 CLOSED

ipinfo avatar ipinfo commented on June 19, 2024
Request: New Map feature to be added

from php.

Comments (5)

vekien avatar vekien commented on June 19, 2024 2

I wonder if it would just be for convenience, I guess it would need to align with the goals of this functionality.

An example use case I have: At my company we monitor AWS ALB logs, and we have reports generated daily about where traffic came from and this uses ipinfo php library to get region/city etc, and we build dashboards on that.

With the introduction of maps I have now added this to our report generation script:

$ipfilename = self::SAVE_PATH .'/ip_list';
file_put_contents($ipfilename, implode("\n", $ips));

// generate map from ipinfo
$response = shell_exec('cat '. $ipfilename .' | curl -XPOST --data-binary @- "ipinfo.io/map?cli=1"');
$response = json_decode(trim($response), true);
$entity->setMapLink($response['reportUrl']);

So I'm basically just doing a shell_exec to run the example your page says, which works perfectly it's all fine and dandy, at the time I just thought "be handy if I could do $ipinfo->generateMapLink($ips) 😊" - This report sends a message on Slack that now includes a link directly to the map. So it's all automated, as our management/higher up love this map lol

Just thought i'd bring up to discuss, as ipinfo is so simple and convenient to use anyway!

from php.

UmanShahzad avatar UmanShahzad commented on June 19, 2024 2

I love that use case, thanks for sharing!

Will get back to you fairly soon about this; hoping we can add it :)

from php.

UmanShahzad avatar UmanShahzad commented on June 19, 2024 2

Alright got the 👍 to implement this; will do it soon.

from php.

UmanShahzad avatar UmanShahzad commented on June 19, 2024 1

Hey @viion , really glad you like the new feature!

From my side, I don't see much value of putting this into the PHP SDK (or any SDK). The output is only going to be some JSON with a link like this:

$ cat ips.txt | curl -XPOST --data-binary @- "ipinfo.io/map?cli=1"
{
  "status": "Report Generated",
  "reportUrl": "https://ipinfo.io/map/7e55cd2d-a6d9-4724-bb6e-e0c8ac7daf6e"
}

If the intention is to input IPs to an SDK function and then use that link to be displayed somewhere in your app, then that would make sense. But I can't see any other use case. What do you think?

@coderholic any idea if this is worth putting into SDKs?

from php.

UmanShahzad avatar UmanShahzad commented on June 19, 2024 1

Available in v2.2.0.

Example from test cases:

$h = new IPinfo();
$url = $h->getMapUrl(file("tests/map-ips.txt"));
echo "got URL ".$url;

from php.

Related Issues (20)

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.