Display Symfony's HTTP request as a cURL request - php

I am trying to troubleshoot a symfony's HTTP client request. How can one display the anticipated request as a cURL request such as the following? Thank you
curl -X 'PUT' \
'https://example.com/projects/01GPX8HPBQ54SA11JKWPWFESM6/document_acl' \
-H 'accept: application/ld+json' \
-H 'Authorization: Bearer blaBlaBla' \
-H 'Content-Type: application/ld+json' \
-d '{}'

Related

Verify if token not expired Github Oauth1

Hey i want know if github have a endpoint to verify if a access_token have expired ?
I have tried this but i have a 404 error
404 would mean you did not authenticate properly.
Make sure to use a PAT (Personal Access Token) to authenticate your query (assuming you are not testing you own PAT itself!)
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \ <==== Important
https://api.github.com/applications/Iv1.8a61f9b3a7aba766/token \
-d '{"access_token":"e72e16c7e42f292c6912e7710c838347ae178b4a"}'

POST application/json data not reaching server

I have an Nginx and PHP container running in docker. When I run the following request, $_POST is empty.
I use the Phpstorm option "Break at the first line in PHP scripts" to Debug.
curl -X POST 'localhost/api/v1/customers' -H 'Content-Type: application/json' --data-raw '{"id":"12345"}'
What can cause that the $_POST is empty? Is there a config in Nginx required?
When I try the request with form data, it works but I need that it works with JSON.
curl -X POST 'localhost/api/v1/customers' -H 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'id=12345'
When posting application/json data, $_POST is always empty and you can obtain the JSON request body with PHP:
$data = json_decode(file_get_contents('php://input'), true);
print_r($data);
$ curl -X POST 'localhost/api/v1/customers' \
-H 'Content-Type: application/json' \
-d '{"id":"12345"}'
Array
(
[id] => 12345
)

Unable to update a form using curl post

I am trying to use a script to interact with the a website however whenever i send my curl post request, nothing is returned.
curl -X POST --proxy 1.1.1.1:9443 \
-H "Content-Type: application/x-www-form-urlencoded" -d d="google.com" -d n="8.8.8.8" \
-d q="A" http://http://www.kloth.net/services/dig.php

convert request from cURL to postman

I am trying to convert the following post request using postman with no luck
> curl "https://192.168.50.52/token" \
> --request POST \
> --include \
> --insecure \
> --header "Content-Type: application/json" \
> --data '["todo.all"]' \
> --user test:test
Set the "secure" => false setting in slim-api if you do not want to use https

Bluemix SSML with PHP

I'm using PHP shell_exec to call the Bluemix Text to Speech API and my code is working well except when I call the text with SSML tags like my second code.
How could I use text and SSML in the same data query?
$result = shell_exec("/usr/bin/curl -k -u 'XXX':'XXX' -X POST \
--header 'Content-Type: application/json' \
--header 'Accept: audio/wav' \
--max-time 90000 \
--output 'public/uploads/audios/padrao_bomdia.wav' \
--data '{\"text\":\"Hello! This is an test.\", \"voice\":\"pt-BR_IsabelaVoice\"}' \
'https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize?voice=pt-BR_IsabelaVoice'");
$result = shell_exec("/usr/bin/curl -k -u 'XXX':'XXX' -X POST \
--header 'Content-Type: application/json' \
--header 'Accept: audio/wav' \
--max-time 90000 \
--output 'public/uploads/audios/padrao_bomdia.wav' \
--data '{\"text\":\"Hello! <say-as interpret-as="letters">Hello</say-as> This is an test.\", \"voice\":\"pt-BR_IsabelaVoice\"}' \
'https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize?voice=pt-BR_IsabelaVoice'");
Does say-as interpret-as="letters" Hello fragment need the escape slashes around 'letters'?
Unfortunately, Only US-English Allison voice supports Expressive SSML. Isabela, the PT-BR voice, does not support SSML. That's why it's not working.
Reference:
Currently, the service supports expressiveness only for the US English
Allison voice (en-US_AllisonVoice). Using the element with any other
voice returns an error.

Categories