I am struggling to make this cURL request in Laravel
curl -d \'{\"key1\":\"value1\", \"key2\":\"value2\"}\' -H \"Content-Type: application/json\" -X GET http:/
Using Laravel, you can write something like this in your routes file if your are using WP and you are feeling adventurous and don't want to use guzzle or laravel curl package.
Route::get('/curl',function() {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://example.net/wp-login.php');
// save cookies to 'public/cookie.txt' you can change this later.
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_POSTFIELDS, ['log'=>'','pwd'=>'']);
curl_exec($ch);
// supply cookie with request
curl_setopt($ch, CURLOPT_COOKIE, 'cookie.txt');
// the url you would like to visit
curl_setopt($ch, CURLOPT_URL, 'https://example.net/profile/');
$content = curl_exec($ch);
curl_close($ch);
// webpage will be displayed in your browser
return;
});