php - Guzzle 422 Unprocessable Entity error -


Code> curl - u "username: password" -h "content-type: application / jason" -h "accept: application / jason" -d '{"browsers": [{"OS": "windows", "OS_version": "7", "browser_version": "8.0", "browser": "i.e."}], "url": "http://google.com"} 'http://www.browserstack.com / Screenshots

However, when I try to call the same call with ghazal , Then I get a 422 unassailable unit error.

$ client = New GuzzleHttp \ Client (); $ Request = $ client- & gt; Post ('http://www.browserstack.com/screenshots', ['headers' => [[Content-Type] => Applications / Jason '],' Ath '= & gt; [' Username ',' password ']]); $ Data = ['browser' = & gt; ['OS' = & gt; 'Windows', 'os_version' = & gt; '7', 'Browser_Version' = & gt; '8.0', 'Browser' = & gt; 'I.e.'], 'url' = & gt; 'Http://google.com']; $ Request & gt; SetBody ($ data); $ Response = $ request-> Send (); Dd ($ response);

Can you suggest debugging this problem?

Send JSON to the Screenshots API, you will need to format it as a JSON string.

  $ client = new GuzzleHttp \ Client (); $ Request = $ client- & gt; Post ('http://www.browserstack.com/screenshots', ['headers' => [[Content-Type] => Applications / Jason '],' Ath '= & gt; [' Username ',' access_key '],' body '= & gt;' {browser} ": [{" OS ":" windows "," OS_version ":" 7 "," Browser-version ":" 8.0 " "Browser": "Android", "OS_Warson": "4.4", "Device": "HTC ONE M8", "Browser": "Android Browser"}], "URL" ":" http://www.tttt: // www. Lipsum.com "} ']);  

Then you will be able to see the progress of your page.

POST request using Ghazle For a guide on how Ejne, you can refer to this document -


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -