Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With stream adapter, $stack[0]->content is null, but with curl it is not #29

Closed
harikt opened this issue Oct 22, 2014 · 4 comments
Closed
Labels

Comments

@harikt
Copy link
Member

harikt commented Oct 22, 2014

Hi Paul,

I should give you some time before I open an issue for version 2 . This is just for future reference and testing the same.

When we use stream adapter the $stack[0]->content is null. When changing to curl it works fine.

<?php
require __DIR__ . '/autoload.php';

$http_factory = new Aura\Http\HttpFactory();
$http = $http_factory->newInstance('stream');

$request = $http->newRequest();
$request->setUrl('https://api.github.com/orgs/auraphp/repos');
$request->setMethod(Aura\Http\Message\Request::METHOD_GET);
$request->headers->set('Accept', 'application/vnd.github.beta+json');
$request->headers->set('User-Agent', 'Mozilla');
$stack = $http->sendRequest($request);
$repos = json_decode($stack[0]->content);
foreach ($repos as $repo) {
    echo $repo->name . PHP_EOL;
}
@pmjones pmjones changed the title stream and curl adapter With stream adapter, $stack[0]->content is null, but with curl it is not Nov 9, 2014
@pmjones
Copy link
Member

pmjones commented Apr 3, 2015

@harikt have you been able to figure out a fix for this?

@harikt
Copy link
Member Author

harikt commented Apr 4, 2015

I wasn't able to figure out :-/ .

@harikt
Copy link
Member Author

harikt commented Aug 8, 2015

I have been trying to understand / send a fix for the issue. But this seems hard to understand why github sends a 403 response only for the stream.

I have tried other urls, but the only issue I can see is from @github api. May be they have something special / checking in the headers which it is not set in the header.

@pmjones
Copy link
Member

pmjones commented Feb 24, 2017

Fixed by 2adb99f (at last)

@pmjones pmjones closed this as completed Feb 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants