Commit Graph

166 Commits

Author SHA1 Message Date
Zach Borboa a79e21b0d1 Fix PHP_CodeSniffer coding standard errors (#993)
* Fix PHP_CodeSniffer errors

Error message:
Header blocks must be separated by a single blank line (PSR12.Files.FileHeader.SpacingAfterTagBlock)

* Fix PHP_CodeSniffer errors

Error message:
Opening brace should be on a new line (Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine)

* Fix PHP_CodeSniffer warnings

Error message:
A file should declare new symbols (classes, functions, constants, etc.)
and cause no other side effects, or it should execute logic with side
effects, but should not do both. The first symbol is defined on line 6
and the first side effect is on line 14.
(PSR1.Files.SideEffects.FoundWithSymbols)
2025-09-15 21:24:22 -04:00
Zach Borboa 45a7b1b671 Add methods like Curl::setGet() for each HTTP request method (#936)
* Adding methods like Curl::setGet() for each HTTP request method

Adding these methods to separate the request initialization from the
execution.

Methods added:
Curl::setDelete()
Curl::setGet()
Curl::setHead()
Curl::setOptions()
Curl::setPatch()
Curl::setPost()
Curl::setPut()
Curl::setSearch()

* Fix loading local test servers

Error message:
    +++ declare -A pids
    run_phpunit.sh: line 77: declare: -A: invalid option
    declare: usage: declare [-afFirtx] [-p] [name[=value] ...]

Error message:
    +++ server_count=7
    +++ pids=()
    run_phpunit.sh: line 85: "7" - 1: syntax error: operand expected (error token is ""7" - 1")

* Clean up
2025-03-23 05:00:39 -04:00
Zach Borboa 5097545a05 Allow displaying curl option value without specifying value 2024-01-18 09:05:46 -05:00
Zach Borboa 1c47fc9d02 Clean up 2023-10-21 06:20:13 -07:00
Zach Borboa 268c9e5630 Clean up 2023-10-21 06:08:18 -07:00
Zach Borboa 350f4daa8a Add flake8 and isort to lint check 2023-09-09 08:41:16 -07:00
Zach Borboa 753bff006f Add isort pre-commit hook 2023-09-08 08:54:15 -07:00
Zach Borboa d829f59154 Update ::afterSend() examples 2023-08-25 07:36:39 -07:00
Zach Borboa 5e5d284a9b Implement Curl::setError() and MultiCurl::setError() 2023-08-22 20:20:47 -07:00
Zach Borboa 2aa035eb05 Clean up 2023-07-15 04:39:10 -07:00
Zach Borboa 0d3a3c1924 Add example for determining urls not yet executed 2023-07-14 21:50:46 -07:00
Zach Borboa 144194730c Add tqdm and curses examples for displaying progress of MultiCurl downloads 2023-07-01 08:45:05 -07:00
Zach Borboa cd924d10c3 Update PHP_CodeSniffer ruleset: PSR2 → PSR12 2023-06-30 01:23:37 -07:00
Zach Borboa 2f532ab2b8 Merge branch 'master' into use-short-array-syntax 2023-06-26 02:57:15 -07:00
Zach Borboa 128a0c1ea2 Add PHP-CS-Fixer to check for unused imports 2023-06-24 19:33:48 -07:00
Robin van der Vliet c45f8e22de Use short array syntax 2023-06-23 19:50:18 +02:00
Zach Borboa 319c1fc285 Rename progress example files to be curl-specific 2023-06-16 15:53:17 -07:00
Zach Borboa 2bb2f32087 Make method to display curl option value public 2023-06-12 20:27:16 -07:00
Zach Borboa 5b39126488 Update article in Curl::diagnose() Allow header warning 2023-05-07 02:50:08 -07:00
Zach Borboa 9954caab60 Update example to avoid use of dynamic properties 2023-02-02 05:29:45 -08:00
Zach Borboa acf8e9f6a0 Include curl error code constant in curl error message (Curl::curlErrorMessage)
Before:
    Timeout was reached: Operation timed out after 30001 milliseconds with 1453867 out of 3000000 bytes received

After:
    Timeout was reached (CURLE_OPERATION_TIMEOUTED): Operation timed out after 30001 milliseconds with 1453867 out of 3000000 bytes received
2022-09-30 07:52:27 -07:00
Zach Borboa cab99aaee5 Add MultiCurl example for retrying with a new unique proxy (#729) 2022-09-28 14:22:30 -07:00
Zach Borboa 7ce0fc5ced Explicitly set desired concurrency 2022-09-28 11:06:44 -07:00
Zach Borboa aebaef528b Add example for queuing requests dynamically 2022-09-23 07:06:39 -07:00
Zach Borboa 642e232dc2 Add examples for Curl::beforeSend() and MultiCurl::beforeSend() 2022-07-01 21:38:18 -07:00
Zach Borboa 8f7c24b71d Add additional logging to display progression 2022-06-23 09:46:46 -04:00
Zach Borboa 523386ec01 Fix #714: Attempt to stop active requests when MultiCurl::stop() is called 2022-06-23 08:26:20 -04:00
Zach Borboa e2408025b8 Fix #702: Add example for processing requests later 2021-12-29 07:48:52 -08:00
Zach Borboa 2c73d6321e Fix #684: Add GET request with port specified 2021-10-03 18:32:45 -04:00
Zach Borboa a4f4223b98 Implement Curl::setStop() for stopping requests early
Use Curl::setStop() to stop requests early without downloading
the full response.
2021-09-15 05:49:25 -04:00
Zach Borboa 0db3c1b227 Fix #675: Use paths with leading slashes 2021-09-14 09:32:45 -04:00
Zach Borboa 6ceabf7293 Clean up 2021-07-26 00:35:01 -04:00
Zach Borboa a9592df07a Add example showing Curl::diagnose() usage 2021-07-20 22:32:51 -04:00
Zach Borboa feca86813d Update urls used in examples 2021-04-03 09:24:19 -04:00
Zach Borboa 64df98c50f Match number of servers started 2021-03-28 23:44:25 -04:00
Zach Borboa 06ca377f64 Add support for using relative urls with MultiCurl::add*() methods
This change allows setting a base url with MultiCurl and adding requests
using relative paths.

Fixes #628.
2021-03-23 11:03:39 -04:00
Zach Borboa 161f9aea63 Use short array syntax 2021-03-18 01:15:52 -04:00
Zach Borboa 05a1a21090 Remove official support of HHVM
As of HHVM 4.0, PHP is no longer supported:
    "With this release, we no longer aim to be compatible with PHP"
    "We are considering removing support for <?php in the next release [...]"
2021-03-17 09:33:50 -04:00
Zach Borboa 43f96a4c8b Clean up 2020-10-27 19:05:58 -07:00
Mao Wang 0982719743 update examples 2020-10-28 09:31:37 +08:00
Mao Wang 5a3a4cca9d update examples 2020-10-28 09:31:03 +08:00
Mao Wang 0e513d3082 update examples 2020-10-28 09:28:02 +08:00
Zach Borboa f5bc12ac56 Add example for using rate limiter via MultiCurl::setRateLimit() 2020-05-16 23:45:59 -07:00
Zach Borboa 1f62ac4428 Fix #606: Add example for fetching range using Curl::setRange() 2020-04-20 23:03:27 -07:00
Zach Borboa c78d271b29 Fix #626: Add MultiCurl example for retrying with a new proxy 2020-04-18 10:40:25 -07:00
Zach Borboa ea66e3bfb9 Standardize the use import statements 2020-04-17 18:47:59 -07:00
Zach Borboa fe1a65b741 Unify file names of download example script 2019-10-31 20:44:05 -07:00
Zach Borboa 33b748c71a Unify Curl and MultiCurl examples 2019-10-31 20:40:52 -07:00
Zach Borboa 04d1db9d54 Rename download file examples 2019-10-31 20:34:36 -07:00
Zach Borboa 11dbef81fe Fix #603: Add note on getting progress indicators to work 2019-10-13 22:28:45 -07:00