0

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.

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by cwarn23
0

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.

Edited by cwarn23: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.