-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Datasource: Fastah IP API #81
Comments
Sounds good!
Can you send me an example response (which fields are you filling) ? You
can also send it privately to wp-geoip-detect posteo.de
Could you create me a test account for 50 requests / months that doesn't
expire after the trial ?
Benjamin
|
Hey Benjamin, I have picked this up again, current work-in-progress branch is here. Any guidance on which HTTP client to use? Is it OK to require availability of PHP-Curl and associated The Fastah API endpoint requires TLS 1.2 and recommends HTTP/2 for performance (and concurrency) , so it would be desirable for this data-provider implementation to use the best possible HTTP/2 client that can be reasonably packed with the plugin or expected to be available in the host installation. Recommendations? :) About your example response question, the REST API response is as follows: {
"ip": "200.38.122.55",
"isEuropeanUnion": false,
"locationData": {
"countryName": "Mexico",
"countryCode": "MX",
"cityName": "Mexico City",
"cityGeonamesId": 3530597,
"lat": 19.44,
"lng": -99.14,
"tz": "America/Mexico_City",
"continentCode": "NA"
}
} Note that only 'en' locale is currently returned. Would be this be good enough to start with? Will send you a trial key too! :) |
Hi,
great to hear!
Please use the HTTP functions by wordpress:
https://developer.wordpress.org/apis/handbook/making-http-requests/
HTTP/2 is normally implemented in libcurl, so it might not be available
on every machine. My suggestion is to have the datasource work on every
host, and then have the possibility to improve performance with HTTP/2
(e.g. an opt-in option of the datasource).
Here is something to get you started:
if (!defined('CURL_HTTP_VERSION_2_0')) {
define('CURL_HTTP_VERSION_2_0', 3);
}
add_action('http_api_curl', function( $handle ){
// Enable HTTP/2
curl_setopt($handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
}, 10);
En locale is ok, yes, not all sources have translated names.
|
I can definitely use the core Wordpress HTTP functions for maximum portability, documentation is great. |
I have looked at your code - yes it's going in a good direction, keep the stream_context. You will need to adjust the error messages accordingly (wp_get_remote should always so the plugin is not requiring curl per se - HTTP/2 support is not required but recommended etc.) Instead of letting them choose an option that is not available on their server, you can show a message "HTTP/2 is not supported on your server. (needed libcurl version: )" and grey out the option. (It is still possible that the option is on and no HTTP/2 support, because the website might be developed locally and then pushed onto another machine.) |
Understood, thank you. |
Hey @benjaminpick |
Hi Benjamin, Summary of observations:
Gist is here, feel free to use :) PS: You may the following command to find network RTT from your host to the HTTP/2 listed in the gist above: |
Again, I can't imagine this plugin would profit from multiplexing, as in most use cases, there will be only 1 Fastah request per PHP call. |
Let's ship it the way it is now in the 'fastah' branch (your preferred v1 implementation). Once we get some real world usage, I will iterate on this based on user needs. Thank you. |
Hello,
Would contributions be welcome for an additional REST API as a data source/backend?
I am the developer of the above API. We at Fastah intend to keep it as a paid offering with a credible support plan (there is a no-cost, 30-day trial available)
How it compares to what's already part of YellowTree
a) mobile IPs coverage - constantly being enhanced, and includes IPv6 deployments by mobile carriers
b) security in transit - HTTPS with TLS1.2+ as the only transport option
c) performance: HTTP/2 out of the box to enable request/response multiplexing. Open to adding in-memory caching to the client-side.
Please let me know if this would be a good idea :)
Sid
The text was updated successfully, but these errors were encountered: