Reputation: 5433
I'm working with a service that requires me to call it via:
curl -u username:password -X POST "http://www.theirurl.com"
I'd like to use Guzzle rather than do a raw CURL, however. Is there a way to have Guzzle pass the -u
parameter? I tried User-Agent, but that's not correct.
Upvotes: 5
Views: 1450
Reputation: 179994
That's not a user agent, that's HTTP Basic Authentication.
$client->post('http://www.theirurl.com/', ['auth' => ['username', 'password']]);
http://guzzle.readthedocs.org/en/latest/request-options.html?highlight=auth#auth
Upvotes: 9