Last active
August 24, 2017 15:43
-
-
Save bmadigan/7e241f10a11e502ab038fff3826e73e1 to your computer and use it in GitHub Desktop.
A sample FastSpring connection attempt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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