Skip to content
This repository has been archived by the owner on Jul 28, 2022. It is now read-only.

Error in "User-Agent header " #10

Open
quoidautre opened this issue Mar 26, 2014 · 0 comments
Open

Error in "User-Agent header " #10

quoidautre opened this issue Mar 26, 2014 · 0 comments

Comments

@quoidautre
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant