Answer the question
In order to leave comments, you need to log in
Can you help me understand the principles of working with the API of third-party resources?
There was, in fact, such a need. Conceptually, I think I understand how it works... But it's easier for me to understand when you see a ready-made, working, simple example...
Registered in a couple of places - mostly paid ones.. Somewhere http, post, get - then curl, rest , soap... with which I have never worked... to pass headers - in general, porridge (
I would be grateful if you give a resource - a lesson, a video lesson ... a ready-made package for laravel or just a php class, where it is clear how the request is formed for server and the data comes in.
UPD: so far I could only implement it through file_get_contents ..
It turned out well ...
$params = array(
'carrier' => $carrier,
'flight' => $flight,
'year' => $arrival->format('Y'),
'month' => $arrival->format('m'),
'day' => $arrival->format('d'),
);
$apiCall = sprintf($this->apiUrl.'flight/status/%s/%s/arr/%d/%d/%d', $params['carrier'], $params['flight'], $params['year'], $params['month'], $params['day']);
$apiCall.="?appId={$this->id}&appKey={$this->key}";
$res=file_get_contents($apiCall);
return json_decode($res);
Answer the question
In order to leave comments, you need to log in
Here, for example, api photolia - a well-known service. https://github.com/robywan/fotolia-api . Look how it's done. Everything seems to be simple.
First you need to learn the language in which you are going to write and understand how the Internet works in general.
And this question will no longer arise.
Without a clear goal, there is no clear HOW.
How to work with any api?
Somehow.
Можете попробовать это
https://market.mashape.com/explore
Это репозитория публиыных API. Каждая имеет документацию, форму для проверки, примеры на разных языка.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question