Skip to content

Instantly share code, notes, and snippets.

@egulhan
Created November 30, 2018 09:09
Show Gist options
  • Save egulhan/d306ed427ecfa5e287bb54554be4e395 to your computer and use it in GitHub Desktop.
Save egulhan/d306ed427ecfa5e287bb54554be4e395 to your computer and use it in GitHub Desktop.
Request with cookies using Guzzle Http Client
<?php
$cookies = [
'geo' => 'TR',
'goip' => 'JO',
];
$cookieJar = \GuzzleHttp\Cookie\CookieJar::fromArray($cookies, 'example.com');
$client = new \GuzzleHttp\Client(['cookies' => $cookieJar]);
$response = $client->request('GET', $url);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment