We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,687 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

How to write php API to be use by othe web sites?

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
24 Minutes
Discussion Span
1 Year Ago
Last Updated
2
Views
stanley87
Light Poster
43 posts since Aug 2010
Reputation Points: 10
Solved Threads: 2
Skill Endorsements: 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.

cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 260
Skill Endorsements: 13

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0561 seconds using 2.62MB