holli@DESKTOP-46NMP4B:~$ curl -v -X POST -i -u "apikey:xxx" --header " +Content-Type: audio/flac" --data-binary x.flac "https://stream-fra.wa +tsonplatform.net/speech-to-text/api/v1/recognize" Note: Unnecessary use of -X or --request, POST is already inferred. * Trying 158.177.93.238... * TCP_NODELAY set * Connected to stream-fra.watsonplatform.net (158.177.93.238) port 443 + (#0) * ALPN, offering h2 * ALPN, offering http/1.1 * successfully set certificate verify locations: * CAfile: /etc/ssl/certs/ca-certificates.crt CApath: /etc/ssl/certs * TLSv1.2 (OUT), TLS handshake, Client hello (1): * TLSv1.2 (IN), TLS handshake, Server hello (2): * TLSv1.2 (IN), TLS handshake, Certificate (11): * TLSv1.2 (IN), TLS handshake, Server key exchange (12): * TLSv1.2 (IN), TLS handshake, Server finished (14): * TLSv1.2 (OUT), TLS handshake, Client key exchange (16): * TLSv1.2 (OUT), TLS change cipher, Client hello (1): * TLSv1.2 (OUT), TLS handshake, Finished (20): * TLSv1.2 (IN), TLS handshake, Finished (20): * SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384 * ALPN, server accepted to use http/1.1 * Server certificate: * subject: C=US; ST=New York; L=Armonk; O=INTERNATIONAL BUSINESS MACH +INES CORPORATION; CN=*.watsonplatform.net * start date: Jan 9 00:00:00 2018 GMT * expire date: Mar 9 12:00:00 2020 GMT * subjectAltName: host "stream-fra.watsonplatform.net" matched cert's + "*.watsonplatform.net" * issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=GeoTrust RSA +CA 2018 * SSL certificate verify ok. * Server auth using Basic with user 'apikey' > POST /speech-to-text/api/v1/recognize HTTP/1.1 > Host: stream-fra.watsonplatform.net > Authorization: Basic YXBpa2V5Onh4eA== > User-Agent: curl/7.58.0 > Accept: */* > Content-Type: audio/flac > Content-Length: 6 > * upload completely sent off: 6 out of 6 bytes < HTTP/1.1 401 Unauthorized HTTP/1.1 401 Unauthorized < Date: Tue, 13 Nov 2018 18:52:41 GMT Date: Tue, 13 Nov 2018 18:52:41 GMT < Content-Type: application/json Content-Type: application/json < Content-Length: 37 Content-Length: 37 < Connection: keep-alive Connection: keep-alive * Authentication problem. Ignoring this. < Www-Authenticate: Basic realm="IBM Watson Gateway(Log-in)" Www-Authenticate: Basic realm="IBM Watson Gateway(Log-in)" < * Connection #0 to host stream-fra.watsonplatform.net left intact {"code":401, "error": "Unauthorized"}
Apparently the authentication with the server is not working. See here for on how to send them credentials properly.


holli

You can lead your users to water, but alas, you cannot drown them.

In reply to Re^3: Translate curl to LWP by holli
in thread Translate curl to LWP by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.