https://github.com/seekaddo/libipify-c
A client library for ipify: A Simple IP Address API in C.
https://github.com/seekaddo/libipify-c
ipify
Last synced: over 1 year ago
JSON representation
A client library for ipify: A Simple IP Address API in C.
- Host: GitHub
- URL: https://github.com/seekaddo/libipify-c
- Owner: seekaddo
- License: mit
- Created: 2017-12-01T05:22:35.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-01T21:22:07.000Z (over 8 years ago)
- Last Synced: 2025-01-24T08:44:01.053Z (over 1 year ago)
- Topics: ipify
- Language: C
- Size: 9.77 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/seekaddo/libipify-c)
## libipify-c[](https://github.com/seekaddo/libipify-c/blob/master/LICENSE)
A client library for ipify: A Simple IP Address API in C.
## Purpose
ipify is the best IP address lookup service on the internet. It's fast, simple, scalable, open source, and well-funded by [Randall Degges](http://www.rdegges.com).
In short: if you need a way to pragmatically get your public IP address, ipify is the best possible choice!
This library will retrieve your public IP address from ipify's API service, and return it as a string. It can't get any simpler than that.
## Usage
```bash
git clone https://github.com/seekaddo/libipify-c.git
cd libipify-c
make all && make install
```
```C
#include
#include
int main(void){
ipify_connect();
// no free needed here. It uses static gloabl buffer of size 4069 which is enough for GET response
char *ipptr = ipify_getIP();
fprintf(stdout, "Public ip is: %s\n", ipptr);
ipify_disconnect();
return 0
}
```
## Test
After running your C program above compare your terminal results with this
```bash
#Do this in the terminal
curl 'https://api.ipify.org?format=json'
#if you don't have curl installed,then use your browser.
https://api.ipify.org?format=json
```