Skip to content

Instantly share code, notes, and snippets.

@bmadigan
Last active August 24, 2017 15:43
Show Gist options
  • Select an option

  • Save bmadigan/7e241f10a11e502ab038fff3826e73e1 to your computer and use it in GitHub Desktop.

Select an option

Save bmadigan/7e241f10a11e502ab038fff3826e73e1 to your computer and use it in GitHub Desktop.
A sample FastSpring connection attempt
<?php
namespace App;
use GuzzleHttp\Client;
class FastSpring {
function __construct()
{
$this->username = 'WA4N3TEDTB6QHE84I9VYMA'; //config('fastspring.username');
$this->password = 'o_fXjS-xSDaizvUl-DCCzQ'; //config('fastspring.password');
}
public function connect()
{
$guzzleClient = new Client();
$credentials = base64_encode("{$this->username}:{$this->password}");
// Neither Works (URL) ... I get a 401 Unauthorized Response
//$response = $guzzleClient->post('https://api.fastspring.com/company/9UIu1yAtQ48', [
$response = $guzzleClient->post('https://api.fastspring.com', [
'User-Agent' => ['Guzzle/4.0 curl/7.21.4 PHP/5.5.7'],
'Authorization' => ['Basic ' . $credentials]
]);
dd($response);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment