Encode a PHP array in JSON or YAML & post to an API