Jump to content

Using HTTP GET To Grab Data from Server Using API Key


Maccyjam

Recommended Posts

Hello,I'm wanting to pull data from a server using a HTTP GET method and then display the data on a HTML webpage.I have looked into this but couldn't find anything regarding it. I assume it will require Javascript or PHP or some other form of scripting, but if someone could be point me in the right direction, that'd be great.Thanks in advance,

Link to comment
Share on other sites

it seems more like you would want to use something like curl to make HTTP requests (GET/POST) in PHP to said server and process the response.http://php.net/manual/en/book.curl.php

  • Like 1
Link to comment
Share on other sites

Didn't know that thescientist. Very cool. Thanks. PM: Scrapbook

Edited by niche
Link to comment
Share on other sites

Thanks for those links, they seem pretty useful.The link takes two parameters when performing the HTTP GET method: One for the API and one for an ID number. Upon accessing it (through a web browser), it provides an XML file of information.So what would be the best method to pull the data using HTML/PHP and then parse the XML tags into an easy to read format in the HTML file?I'm sorry for the large and probably stupid sounding request, I'm new to PHP and things like that but it is something that I would definitely like to learn.

Link to comment
Share on other sites

review the cURL documentation or look for some simple examples online. after that, you can use simple xml to load a string into an XML document for you to work with.http://php.net/manual/en/book.simplexml.php

Link to comment
Share on other sites

http://in.php.net/manual/en/simplexmlelement.construct.php if it is GET you can send directly a GET request from simplexml by specifying file URL in first param in constructor followed by passing true to third param and then fetch the xml document.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...