A
A
Anton2015-08-25 11:59:53
PHP
Anton, 2015-08-25 11:59:53

How to make multiple requests to JSON in 1st file?

Colleagues, welcome, the question is as follows:
I make a request to api, I get the correct json response, I get the necessary data, I display the necessary data.
json url:

$json_url = file_get_contents ('http://api.ya-bot.net/projects/'.$id.'/reports/'.$date.'/positions'.'?token='.$api_key.'&url='.$url.'&sengine='.$sengine.'&region='.$region);

json response:
{
"positions":[
{
"query":"",
"wordstat":,
"groups":null,
"target_url":false,
"position":,
"change":-2,
"documents":,
"title":"",
"snippet":"",
"relpage":{
"url":""
}
},

I rubbed the values ​​themselves in places.
So, I display values ​​like "query":"","wordstat":. But I also need to compare this data with others, which I can only get by making another request and passing other parameters. For example, I want to get group from another response and match group - query - wordstat.
What is the best way to implement this? I ask for your advice, thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav Dragalev, 2015-08-25
@vladqwerty

if you store the response you get in the foo object, do the 2nd query, storing the response in the bar object, then compare what you want foo.positions.query == bar.positions.query.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question