citywide440 Posted November 20, 2013 Share Posted November 20, 2013 Im trying to work with a Companies API Program - I have never done any coding or used PHP before - Im currently stuck at how do I create the authentication code What program should I use ? How do i do it ? - I have all the info it requests Secret key, account id and image id but I have no ideal what to do with it. Im currently stuck and really need help with this. Below is exactly what is listed on there site - Thanks in Advance PurchaseOnce you have funded your API account you will be able to download full resolution un-watermarked images. Purchasing images requires an authentication key to be passed with each request. The authentication key is generated using the secret key provided and is a combination of the secret key, your account ID and the image ID the user is purchasing. The authentication key is the SHA-1 hash (40 character hexadecimal) of those three data elements. // Example PHP code to generate auth_key for purchase request $auth_key = sha1($secret_key . $account_id . $image_id); The auth_key that is generated needs to be passed with the purchase request. To purchase an image, include the image ID, Size Code and the authentication key. api.bigstockphoto.com/2/[account id]/purchase?image_id=[image id]&size_code=&auth_key=[auth_key] If the purchase is approved, a download ID will be returned which can then be used to download the image file. {"response_code":200, "message":"success", "data":{ "currency_amount":2.99, "currency_code":"USD", "download_id":724111049} } Quote Link to comment Share on other sites More sharing options...
MDCode Posted November 20, 2013 Share Posted November 20, 2013 So are you coding it, or trying to forge one? The company should have sent you or displayed to you your "secret key" at one point or another. Quote Link to comment Share on other sites More sharing options...
citywide440 Posted November 20, 2013 Author Share Posted November 20, 2013 They sent me my Secret Key but I need to generate a authentication key - Not sure how to create one // Example PHP code to generate auth_key for purchase request$auth_key = sha1($secret_key . $account_id . $image_id); Quote Link to comment Share on other sites More sharing options...
MDCode Posted November 20, 2013 Share Posted November 20, 2013 (edited) Ignore Edited November 20, 2013 by SocialCloud Quote Link to comment Share on other sites More sharing options...
citywide440 Posted November 20, 2013 Author Share Posted November 20, 2013 I have no ideal what to do with it - I dont know what program to type it into or run it with Quote Link to comment Share on other sites More sharing options...
MDCode Posted November 20, 2013 Share Posted November 20, 2013 There are a few ways to connect to an api. The most popular in API documentation being file_get_contents(); <?php $response = file_get_contents("URL here"); echo "Response from the server was: ".$response; ?>You could also use cURL if you would want to add more advanced options. But this should work as you only need json it seems. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.