M
M
Messi2018-05-30 19:39:18
Yii
Messi, 2018-05-30 19:39:18

How to make a get request for instagram?

Hello! Tell me, please, when I "logged in" to the web version of Instagram and clicked on the button for the number of friends, a get request was sent:

https://www.instagram.com/graphql/query/?query_hash=1215Z2b820144728dde7facb0d904896a&variables={"id":"1234567890","first":24}

When I open this link in the browser, everything is fine, I get json data. Now trying to do it through Yii2 httpclient
$client = new Client();
        $response = $client->createRequest()
            ->setMethod('get')
            ->setUrl('https://www.instagram.com/graphql/query/')
            ->setData([
                'query_hash' => '1215Z2b820144728dde7facb0d904896a',
                'variables' => '{"id":"123456789","first":24}'
            ])
            ->send();

I constantly receive headers in the response:
http-code: 403
content-type: text/html; charset=utf-8
How to make a request through php?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2018-05-30
@webinar

How to make a request through php?

pass all the cookies that were received when "logged in"

P
Puma Thailand, 2018-05-30
@opium

You need to send the correct cookie hash and headers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question