Hello to everyone!
I have a problem…
With php, I’m trying to make a request to the twitter api v2 to be able to extract data
I have started from the basis of replicating the request that I make in postman and which works
Starting from the point that the query in postman works for me, with the following code I have tried to replicate the same in php and with the necessary keys
The result of the php query is as follows:
[GET](https://api.twitter.com/2/users/id_user/tweets?exclude=retweets,replies&max_results=100&start_time=2022-09-02T00:00:00Z&end_time=2022-09-20T23:59:59Z&tweet.fields=created_at,id,public_metrics,text&expansions=attachments.media_keys&media.fields=public_metrics,url,preview_image_url)
The query header
Authorization: OAuth oauth_consumer_key="consumer_key_value",oauth_signature_method="HMAC-SHA1",oauth_nonce="501137382632adcb6101c21.28033444",oauth_timestamp="1663753398",oauth_version="1.0",oauth_token="token_value",oauth_signature="ZN3VRlgrPAP13HEZbQYNRg4cj40%3D
Then the api gives me to the next response:
{ "title": "Unauthorized", "type": "about:blank", "status": 401, "detail": "Unauthorized" }
But the same request on postman works…
Could someone please help me
I don’t know if I am skipping any step, if I have missed any field, etc…
PS: I use the php OAuth library found in the official documentation.