我很难在拉维尔提出这个卷发要求
curl -d '{"key1":"value1", "key2":"value2"}' -H "Content-Type: application/json" -X GET http://my.domain.com/test.php
I've been trying this:
$endpoint = "http://my.domain.com/test.php";
$client = new \GuzzleHttp\Client();
$response = $client->post($endpoint, [
GuzzleHttp\RequestOptions::JSON => ['key1' => $id, 'key2' => 'Test'],
]);
$statusCode = $response->getStatusCode();
但是我收到了一个错误Class 'App\Http\Controllers\GuzzleHttp\RequestOptions' not found
Any suggestions?
EDIT
我需要从$response
中的API获得响应,然后将其存储在DB中…我怎么才能做到这一点呢?:/