0

リップル API ( https://ripple.com/wiki/JSON_Messages )からアカウント ステータスを取得するコードを作成しようとしています。私が現在使用しているコード:

    #require "netclient";;
    open Http_client.Convenience;;

    let account_info =
      [
        ("command","account_info");
        ("account","my_account_key")
      ]
    ;;

    let response = http_post_message "http://s1.ripple.com:51234" account_info;;

http://s1.ripple.com:51234にリクエストを送信しましたが、Bad Request エラーが発生しました。注: メソッドとコマンドの両方をパラメーターとして試し、http_post メソッドと http_post_message メソッドも試しました。

    # response#status;;
    - : Http_client.status = `Client_error
    # response#response_status;;
    - : Nethttp.http_status = `Bad_request

私はデータを要求する方法で根本的に間違ったことをしているに違いありませんが、どこが間違っているのかを知るには、この主題に関する十分な経験がありません. Http_client.post_raw メソッドを使用する必要があるのではないかと考えましたが、私のトップレベルはこのメソッドを認識できません。エラーを修正する方法がわかりません。

    # Http_client.post_raw;;
    Error: Unbound value Http_client.post_raw        

前もって感謝します。

4

2 に答える 2

1

サーバーに問題がある可能性があります:

$ curl -v http://s1.ripple.com:51234/
* About to connect() to s1.ripple.com port 51234 (#0)
*   Trying 54.200.86.207...
* Adding handle: conn: 0x7f92a1808c00
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7f92a1808c00) send_pipe: 1, recv_pipe: 0
* Connected to s1.ripple.com (54.200.86.207) port 51234 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.32.0
> Host: s1.ripple.com:51234
> Accept: */*
>
* Empty reply from server
* Connection #0 to host s1.ripple.com left intact
curl: (52) Empty reply from server

私は OcamlNet をよく使用していました。アドバイスできる場合は、前に端末で curl を使用して URL をテストしてください。

于 2013-11-25T10:02:07.017 に答える