An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

[![build](https://img.shields.io/travis/seekaddo/libipify-c.svg)](https://travis-ci.org/seekaddo/libipify-c)

## libipify-c[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](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

```