How to convert below curl command to Guzzle?

1,937 views
Skip to first unread message

Dimitris Kim

unread,
Mar 31, 2014, 12:05:54 PM3/31/14
to guz...@googlegroups.com
Hi,

I'm trying to convert below curl command to php and I want to use Guzzle. Do you happen to know how to do that, please? It is using json format as body content. 

curl http://api.mine.com -H "Content-Type:application/json" -d '{"objects":["/temp/index.html", "temp/index2.html", /temp/a/indexl.html"]}' -u username:password

Any comments would be much appreciated. 


Thank you.

D

Dimitris Kim

unread,
Mar 31, 2014, 1:07:43 PM3/31/14
to guz...@googlegroups.com
Below one works. Thank you.

$response = GuzzleHttp\post('https://api.mine.com', [
'auth' =>  ['username', 'password'],
                'headers' => ['Content-Type' => 'application/json'],
                'body' =>  '{"objects":["/temp/index.html", "temp/index2.html", /temp/a/indexl.html"]}'
   ]}
]);

Faizyab Genetech

unread,
Apr 23, 2018, 3:27:57 AM4/23/18
to Guzzle - PHP HTTP client and REST client framework

curl -X GET \ "https://api.dialogflow.com/v1/entities?v=20150910" \ -H "Authorization: Bearer YOUR_DEVELOPER_ACCESS_TOKEN" \ -H "Content-Type: application/json"

How can I convert above curl in guzzle. plz help
Reply all
Reply to author
Forward
0 new messages