Answers for "curl error laravel"

0

laravel curl request

$client = new GuzzleHttp\Client;

$response = $client->get('https://api.example.com/api/AvailabilitySearch', [
    'headers' => [
        'Authorization' => 'Bearer YOUR_TOKEN_HERE',
    ],
    'form_params' => [
        'VisitDate' => '2017-05-08',
        'PartySize' => '2',
        'ChannelCode' => 'ONLINE',
    ],
]);

// You need to parse the response body
// This will parse it into an array
$response = json_decode($response->getBody(), true);

/////////////////////////////////////////////////////

$endpoint = "http://my.domain.com/test.php";
$client = new \GuzzleHttp\Client();
$id = 5;
$value = "ABC";

$response = $client->request('GET', $endpoint, ['query' => [
    'key1' => $id, 
    'key2' => $value,
]]);

// url will be: http://my.domain.com/test.php?key1=5&key2=ABC;

$statusCode = $response->getStatusCode();
$content = $response->getBody();

// or when your server returns json
// $content = json_decode($response->getBody(), true);
Posted by: Guest on September-14-2020
0

cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)

Do not ever modify files in the vendor/ folder. Ever. They can and will be
overwritten on the next composer update you run.

Here is my Solution for WampServer

I am using PHP 7.1.9 for my WampServer, so change 7.1.9 in the example below 
to the version number you are currently using.

1. Download this file: http://curl.haxx.se/ca/cacert.pem
2. Place this file in the C:\wamp64\bin\php\php7.1.9 folder
3. Open php.iniand find this line:
	;curl.cainfo

4. Change it to:
	curl.cainfo = "C:\wamp64\bin\php\php7.1.9\cacert.pem"

5. Make sure you remove the semicolon at the beginning of the line.

6. Save changes to php.ini, restart WampServer, and you're good to go!
Posted by: Guest on July-14-2020

Browse Popular Code Answers by Language