github-api3-php
github-api3-php copied to clipboard
Error in "User-Agent header "
Hi there,
I'm trying to use the api, but with this basic code :
require_once dirname(__FILE__) . '/github-api3-php/lib/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php'; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); // Register the location of the GitHub namespace $loader->registerNamespaces(array( 'Buzz' => __DIR__.'/github-api3-php/lib/vendor/Buzz/lib', 'GitHub' => __DIR__.'/github-api3-php/lib' )); $loader->register(); use GitHub\API\Authentication; use GitHub\API\User\User; use GitHub\API\AuthenticationException; use GitHub\API\User\User; // Setup the user, and authenticate (using basic HTTP auth) $user = new User(); $user->setCredentials(new Authentication\Basic('quoidautre', 'MY_PASSWORD')); $user->login(); // Get the user details $response = $user->get(); var_dump($response);
I've this error :
object(Buzz\Message\Response)[8] protected 'headers' => array (size=4) 0 => string 'HTTP/1.0 403 Forbidden' (length=22) 1 => string 'Cache-Control: no-cache' (length=23) 2 => string 'Connection: close' (length=17) 3 => string 'Content-Type: text/html' (length=23) protected 'content' => string 'Request forbidden by administrative rules. Please make sure your request has a User-Agent header (http://developer.github.com/v3/#user-agent-required). Check https://developer.github.com for other possible causes.' (length=213)
Any idea ?, can anybody helps me ?
Thanks. Fabrice