• I’m trying to fix problems with a currently semi working API client
    The syntax in the documentation is :

    curl -X POST 'https://api-free.deepl.com/v2/translate' \
    -H 'Authorization: DeepL-Auth-Key [yourAuthKey]' \
    -d 'text=Hello%2C%20world!' \
    -d 'target_lang=DE'

    The wp_remote_request body argument serves body content as a single string and not as a series of -d ‘key=value’

    Is there any way to force a request via WordPress functions to send body via this syntax ?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    -H is a header you must send, so use the “headers” arg for that.
    -d is arbitrary data that’s formatted like form data would be, so essentially the same as you would do for an URL query string, except in the body:
    'text=Hello%2C%20world!&target_lang=DE'

    At least I think so. Unconfirmed. I hope this helps you.

Viewing 1 replies (of 1 total)
  • The topic ‘How to send -d data via wp_remote_request ?’ is closed to new replies.