Announcing the Inkdit API

Big news for the Inkdit team – today we’re officially opening up our API to the public! You can register and find documentation on our API’s site.

Our API allows developers at your organization to write applications that can create, share and sign contracts that will be securely stored with cryptographic tamper-resistance on Inkdit.

There are a lot of applications that involve agreements – license agreements, sign-offs, waivers, etc. Using Inkdit’s API your applications can capture those agreements in a tightly integrated way.

Shortly before the holidays we quietly released a Ruby library for interacting with Inkdit’s API (available as a gem named ‘inkdit’, with documentation here).

If you’re using we hope you’ll take a look at the library. If you’re not using Ruby, we hope you’ll look at it anyways – we’ve written it so that it can work as an example for other languages as well.

So what’s coming next? We’ve got big plans for our API; we have a sophisticated tiered user authentication system in the works, and we’d like to make that available for developers to build on top of.

The exciting thing about putting out an API is people are going to find uses for it that we’ve never thought of ourselves. We want to make it as easy as possible for people to use Inkdit to create new applications, so tell us what you need!

Is there a new application you’d like to see built on top of Inkdit?

Do you use an application that would integrate well with us?

Are there new capabilities you’d like us to expose to the API?

We’re looking into other languages to build libraries for. Is there a particular language that you would like code examples or a library for?

Via: Inkdit

Work with RSS feeds using PHP and cURL

cURL or Client URL Library is a very powerful tool, and its something that i recently had to use while working with two APIs one for Unfuddle and one for HelpSpot.

PHP supports libcurl, a library created by Daniel Stenberg, that allows you to connect and communicate to many different types of servers with many different types of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this can also be done with PHP’s ftp extension), HTTP form based upload, proxies, cookies, and user+password authentication.

These functions have been added in PHP 4.0.2.

You can interact with most APIs using cURL, at first it seams intimidating but once you start to use it you become comfortable with the set up.

Lets get started by parsing an RSS feed.

Continue reading “Work with RSS feeds using PHP and cURL” »

How to use Google HTTP Geocoding

Google Maps - Edmonton

Getting the Latitude and Longitude of an address using the Google Maps API is actually quite easy.

Google makes this process easy buy letting us interact with their API using a URI via a HTTP Request.

By using a PHP function called urlencode I take the Address values and convert spaces to underscores so your URI won’t explode and make Google angry.

Google is nice enough to give us formatted XML, KML, CSV, and even JSON. The basic URL looks something like this http://maps.google.com/maps/geo?q=address+city+state&output=xml using a plus (+) signal the next field like City, Province, or Postal Code.

Click to see output example.

In my application all my contact information is stored in a Database, when I save or update a contact I generate the URL and bring back some XML to work with.

   $googleAddress = "http://maps.google.com/maps/geo?q=".urlencode($address) .'+'. urlencode($city) .'+'. urlencode($province).'+'. urlencode($country)."&output=xml";

The next task was to get the contents of the file, for this I use the “file_get_contents” function and pass it my URL.

   $googlePage = file_get_contents($googleAddress);

PHP has a neat little function called SimpleXMLElement that will convert XML to an object.

Note: The SimpleXMLElement will only work in PHP 5+.

$xml = new SimpleXMLElement($googlePage);

Now that we have the values from the XML we can assign variables to them that will allow us to display the results.

http://ca.php.net/xml

list($longitude, $latitude, $altitude) = explode(",", $xml->Response->Placemark->Point->coordinates);

At this point you can use the information and store it in a database as I did, Or just echo it out.

echo "Longitude: $longitude, Latitude: $latitude";

Here is the full code:

$address = '1 Sir Winston Churchill Square';
$city = 'edmonton';
$province = 'alberta';
$country = 'canada';
$postalcode = 'T5J 2R7';

// Google Geo Address
$googleAddress = "http://maps.google.com/maps/geo?q=".urlencode($address) .'+'. urlencode($city) .'+'. urlencode($province).'+'. urlencode($postalcode).'+'. urlencode($country)."&output=xml";

// Retrieve the URL contents
$googlePage = file_get_contents($googleAddress);

// Parse the returned XML file
$xml = new SimpleXMLElement($googlePage);

// Parse the coordinate string
list($longitude, $latitude, $altitude) = explode(",", $xml->Response->Placemark->Point->coordinates);

// Output the coordinates
echo "Longitude: $longitude, Latitude: $latitude";

Links:
Google Geocoding HTTP Request