I've been working around with API's in PHP to get all sorts of information just for fun. One particular one is the stock prices, I like the way they go UP and DOWN and I like to display all the data and maybe analyze it sometimes.
So API's, I started with a simple SOAP using SOAPUI to analyze the input and output and then I would just do a $client = new Soap(...) and that was it. The API would return XML and I would iterate through an array using PHP to get all the data. Smooth stuff.
Then I found out SOAP was dieing, the API's (key-free) didn't have the up time I would like, and the data would take 10 seconds to arrive. So I tried a new API and I found out the Yahoo Finance API using YQL and I'm enjoying it very much.
The thing is, to get the data I use a query similar to SQL and then I use file_get_contents($url_with_the_query); and it returns either a JSON or XML output with all the data I asked for (json is cool btw), the question is, does this counts as API usage? Like.. can I say "I USE API's LIKE A BOSS" using file_get_contents?
On other note, I tried to test something out, to create my own API, and I did something similar but the file_get_contents on one end would be something like:
"URL.com/API.php?query=date&apiKey=somehashhere&apiSecret=someotherhashhere"
And on API.php @ URL.com there would be a
Code: Select all
if($_REQUEST['query'] == "date")
{
//check api key and secret and echo date();
}
Does it count as an API too ?
Thanks