Comments (3)
In documentation says to get the status code is getCode() but actually is getStatusCode().
The ResponseInterface
defined by PSR-7 provides a getStatusCode()
method which should give you access to the HTTP response status code.
Additionally, this library throws a ResponseException
by default (see options) if a 4xx or 5xx response status code is encountered. This exception provides a getCode()
method as mandated by the underlying exception base class. This method should give you access to the HTTP response status code and is equivalent to calling $exception->getResponse()->getStatusCode()
.
Edit:
Just tried and if i go with foreach through $urls and then call $client->get(); is not going asynchronous so how to pass links to asnyc loop?
This sounds about right. See also the provided examples in the examples/
folder. Additionally, if you're sending a lot of concurrent requests, you may want to limit this concurrency to a reasonable limit (say no more than a dozen or so at once). See also https://github.com/clue/reactphp-mq.
I hope this helps
I believe this has been answered, so I'm closing this for now. Please come back with more details if this problem persists and we can reopen this
from reactphp-buzz.
Thanks for the answer.
I actually tried also https://github.com/clue/reactphp-mq but this results in a longer loop than usual foreach.
On tests, if i set 2 queues takes 18 minutes to go through 300 links and normal foreach with curl 6 minutes. Any other suggestions?
from reactphp-buzz.
Ouch, this really shouldn't have happened! I've been using this in a fair number of projects and it's not uncommon to see a 10x improvement when using an appropriate concurrency setting.
Of course it all depends on the particular problem you're trying to solve and also on what the remote end is capable of serving. Can you gist your code so more people can take a look at this?
from reactphp-buzz.
Related Issues (20)
- Do not try to follow 304 (Not Modified) response
- Add to Response last effective Request or URI object HOT 3
- Truncated answers HOT 3
- Allow other PSR7 abstraction HOT 2
- Support HTTP upgrades (WebSocket etc.) HOT 1
- is $loop->run(); blocking? HOT 2
- Support HTTP 1.1 HOT 1
- Consider excluding upload time from timeout
- Example times out for http://yandex.ru/ HOT 3
- Middleware HOT 7
- Dropping support for PHP < 7.x HOT 2
- Request Timeout exception HOT 3
- Consider replacing array of options with dedicated methods HOT 2
- Client slow with Telegram urls HOT 1
- There is a way to send mutipart form data? HOT 1
- Allow sending raw request strings HOT 1
- Allow receiving the raw response body HOT 3
- Invalid content length for HEAD requests HOT 1
- Heads up! Development focus on react/http
- RFI: Deprecation of send() HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactphp-buzz.