Dear all friends,


Currently I want developing an API so that others web site also can use the API's information by using the API code generate by my web site.Any people can give the idea on how exactly the API works?My basic requirement are:

1.my website generate the public API code(in javascript format) for other website owner to use the code directly after the user have register in my database

2.other website owner that using the API code will provide the unique mac address of the user's devices access to my website's API.

3.Then I will store the passing mac address from other's site into my database while users go through my website API.

Kindly give me any references or the simple way how to generate my API code so that other's website can use my API code to retrieve database data base on the API key(secret key) provide by my website.Thanks in advance.

to generate an api code simply use the following function

<?php
function api_code($salt) {
return sha1($salt.time().substr($salt,-floor(strlen($salt)/2)));
}

echo api_code('my_secret_salt');

Then store your api codes in a database to refer to so that you can check if an api code is valid or not.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.