D
D
Dmitry Cherednichenko2014-12-08 19:23:16
PHP
Dmitry Cherednichenko, 2014-12-08 19:23:16

How to do this in php?

Hello! How to execute this request in php?

POST /myservice HTTP/1.1
Host: rpc.example.com
Content-Type: application/json
Content-Length: ...
Accept: application/json

{
    "jsonrpc": "2.0",
    "method": "sum",
    "params": { "b": 34, "c": 56, "a": 12 },
    "id": 123
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2014-12-08
@thewind

CURL? php.net/manual/en/book.curl.php
all these headers are easily set via curl_setopt

R
Rishat Kadyrov, 2014-12-08
@laska

Usually use cURL
But you can also file_get_contents with the third argument filled in.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question