Php and connecting to an API -


This can be a very basic question because I am quite new to PHP programming. I hope I can learn something about my special issue.

I am trying to create a simple web application that will be working with PHP which will interface with the BBYOpen API provided by Best Buy.

Now provides the query for BBYOpen developers, which I have managed to find one to use.

My problem is new to PHP, this is:

  1. How can I create a simple HTML page that will accept user input, a zipcode and Distance form) and tie in the php script that can communicate with BBYOpen to retrieve the data.

  2. Provides extensive documentation for the BBYOpen query and the information I can make is a viable return, but how to get my PHP script to connect to BBi Open I know that I need to use my remix web service to connect, but I also tell how to go about doing this.

    The solution will also be appreciated in a general code with any help or comments.

    Cheers

      $ ch = curl_init ('http: // Api.remix.bestbuy.com/v1/products?apiKey=apiKey&format=json '); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, true); Curl_setopt ($ CH, CURLOPT_HEADER, true); Curl_setopt ($ ch, CURLOPT_HTTPHEADER, array ('content-type: application / jason',)); $ Result = curl_xac ($ CH); $ Header_size = curl_getinfo ($ ch, CURLINFO_HEADER_SIZE); $ header = substr ($ result, 0, header_ size); $ body = substr ($ result, $ header_size); Curl_close ($ ch); Echo "& lt; east & gt;"; Print_r (json_decode ($ body));   

    Finally you can get the data;

      $ json = file_get_contents ('php: // input'); $ Data = json_decode ($ json, true);    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -