Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Bitmads
    @bitmads_gitlab
    kesselb
    @kesselb
    Hey and thanks for guzzle ;) I though to ask here before creating a issue. Probably there is a easy way to fix that. Someone reported issues with adding a feed. The app uses feed-io to parse rss feeds and feed-io uses guzzle. There is a method isModified to tell if a feed is modified or not. Internally it checks the status code and if the body size is greater 0. And now guzzle comes into the game. A request using StreamHandler to http://rss.kicker.de/news/2bundesliga will return a valid body size greater 0. The same request using CurlHandler 0. Here is a mwe: https://gist.github.com/kesselb/34a522300f9e1ad772241b4cda66bb85 Any ideas? ;)
    phillmac
    @phillmac
    @kesselb I think this is the intended behaviour for guzzle at least. If the rss feed does not implement some way of requesting feed items a
    After a specific date then isModified will always be true, because the rss feed will always have content
    I'd recomend instead checking if getLastModified() has changed since the last request
    In any case this isn't a bug in guzzle. PM me if you want to discuss futher
    phillmac
    @phillmac
    Seems like Guzzle uses fstat() to determine the size of the stream, but the handle doesn't report a size because it isn't a file handle. Im not sure if thats something that needs to be fixed
    kesselb
    @kesselb
    Do you want me to report that as issue? getSize should return null if the body size is unknown according to the doc block.
    phillmac
    @phillmac
    Yeah sure why not
    Mauro Spivak
    @mspivak
    Hey there! I'm working with a Pool of Requests. When a request is successfully fulfilled, I want to be able to know the URL of the request, so I can (say) print a message, but all I get is a response object and an index
    ctrldotnet
    @ctrldotnet
    Does anyone happen to know of a code example or way where I could run Guzzle as a service, i.e essentially have it check against say Redis for new URLs to fetch? Currently it stops running once all promises are fulfilled in the setup I have. I mainly need it for retrying timeout requests with modified request options (the latter part being the problem), i.e changing proxy or header., so having it daemonized would help in sending requests back into the pool to scrape.
    Roskovynskyi
    @oleksandr-roskovynskyi
    What is the fastest way to send 100,000 HTTP requests to PHP and retrieve data from them? Need to get numerical values from a large list of profiles on the REST API + JWT, aggregation method API system where you need to get data there.
    ctrldotnet
    @ctrldotnet

    @oleksandr-roskovynskyi fastest way isn't by using Guzzle, as great as Guzzle actually is.. If absolute maximum speed efficiency is desired, you're best off using an approach utilizing fsockopen and pcntl_fork or similar. Or simply use curl-multi (which Guzzle does too) directly. There's quite a few different approaches to these things, and I think stackoverflow is the best place to find the niche solutions you might look for. It also depends on whether or not your target server is expecting your multitude of connections.. if so, then you can just go nuts and open up 1000 threads. If not, then do keep in mind that webmasters often optimise their setups based on average traffic and your sudden flood of requests could cause problems for them.

    If you're set on using Guzzle, the Pool/Batch mode is what you're looking for. Keep in mind though that the result set will grow in memory until all results have been returned. If you want async return, look into using iterators and each_limit.. @alexeyshockov has an awesome code example for that here: https://github.com/alexeyshockov/guzzle-dynamic-pool .. It creates the requests sequentially though, so it's not optimised for speed, but it's still fairly fast once it has opened all the threads it's allowed to.

    still-dreaming-1
    @still-dreaming-1
    I'm a bit confused about PSR-7 and why adding guzzle my project is suggesting the following: guzzlehttp/psr7 suggests installing zendframework/zend-httphandlerrunner (Emit PSR-7 responses)
    The other suggesting about the intl extension at least explained what the impact was, performance. But I'm not sure how Guzzle would be different with or without that other zend thing.
    It got more confusing from there because I looked at their github page, https://github.com/zendframework/zend-httphandlerrunner and it says it has moved to https://github.com/laminas/laminas-httphandlerrunner
    But I don't know if that newer project is compatible with guzzle or not, or if installing either of those would help guzzle in any way.
    phillmac
    @phillmac
    Seems like there was a name change for some reason
    so it should be compatible. as to the benefits i guess there's nothing like a good 'ol benchmark
    still-dreaming-1
    @still-dreaming-1
    I'm still confused though. Are you saying just installing it will cause it to be used by Guzzle, and could potentially affect performance?
    I installed Guzzle 6.5, since that is what got installed by default (since 7 is still beta), and 6.5 is still recommending the old zend library, which makes me even more unsure of if the new one would be compatible with 6.5
    phillmac
    @phillmac
    Fair enough, I wouldn't worry about it, you can read some of the back story here guzzle/psr7#204
    If you don't know what it's for, you prolly don't need it
    still-dreaming-1
    @still-dreaming-1
    Hmm. From that is seems like it doesn't matter at all unless I am making an HTTP server. I'm only using Guzzle as a client to communicate with a server, so I guess I don't need to worry about it.
    phillmac
    @phillmac
    Seems that way to me too
    still-dreaming-1
    @still-dreaming-1
    Cool thanks
    still-dreaming-1
    @still-dreaming-1
    I'm having hard time understanding enough to put a request together for alpaca where it uses my API key for authentication. Here is an example of what I'm wanting to do if it were done with curl from a terminal: curl -X GET \ -H "APCA-API-KEY-ID: {YOUR_API_KEY_ID}" \ -H "APCA-API-SECRET-KEY: {YOUR_API_SECRET_KEY}"\ https://{apiserver_domain}/v2/account
    You can see the example better here: https://alpaca.markets/docs/api-documentation/api-v2/
    It's under the authentication heading
    phillmac
    @phillmac
    still-dreaming-1
    @still-dreaming-1
    Hmm, yeah looks like that should do what I want pretty simply. I was looking at the stuff for constructing the client prior to making the request.
    phillmac
    @phillmac
    $client = new GuzzleHttp\Client(['headers' => ['X-Foo' => 'Bar']]);
    If you wanna do it that way rather then per request
    still-dreaming-1
    @still-dreaming-1
    Okay, I guess I was just over complicating it somehow. I will try it
    still-dreaming-1
    @still-dreaming-1
    Hmm. I'm getting an error from Curl. I wonder if I even have curl? I'm on Windows 10. My use case is very abnormal. I'm not running code from a server or for a website, it is just a desktop GUI application running on my computer.. Do you know how I would check if I have curl available to Guzzle?
    Looks like it is enabled in my php
    So I guess I have curl
    still-dreaming-1
    @still-dreaming-1
    It's working! I had to download CA certificates, and set the path of the file on my php.ini for the curl settings. My code is downloading stuff from the Alpaca API now!
    rpicheta
    @rpicheta
    Hi all! Is there any way to set base_uri in different way than pass it thru constructor?
    DiegoFSFlor
    @DiegoFSFlor

    $eachPromise = new EachPromise($promises, [
    'concurrency' => 2,
    'fulfilled' => function (Response $response) {
    if ($response->getStatusCode() == 200) {
    $data = json_decode($response->getBody(), true);
    // processing response of user here
    echo "successes";
    }
    },
    'rejected' => function ($reason) {
    echo "fail";
    }
    ]);

    is there any way for each promise to execute Cade sends after a few seconds?
    For example, at concurrency you have informed 2, so it will send every 2 times, and put a time that after 5 seconds it sends again, similar to a pause at each sending.

    Quiec
    @Quiec
    Hi I have a problem
    GuzzleHTTP converting url to capital letters
    Quiec
    @Quiec
    CURLE_URL_MALFORMAT
    Edgar Ibrahimov
    @eibrahimov
    Hi all,
    I use Guzzle to authentication https://auth.prestashop.com/login with method POST and params email, password, and SubmitLogin.
    Before POST request I need also add to here hidden _token params getting from the first request by the GET method to this link. How I can do it with the best practice? Thank you
    Arne Groskurth
    @arnegroskurth
    Does anyone know if I can extract the complete HTTP message that is actually send over the wire for both PSR7 request- and response-objects?
    Without writing that myself...
    Arne Groskurth
    @arnegroskurth
    FYI: \GuzzleHttp\MessageFormatter