| Recommend this page to a friend! |
| Packages of Caleb | PHP Common Class Library | _docs/Request.md | Download |
|
|||||||||||||||||||||
Documentation for the "Request" class.Used by CIDRAM and phpMussel to send outbound requests through cURL. How to use:
DefaultTimeout property.Sets the default timeout to use for any requests which don't specify their own timeout.
Channels property.Can be used to specify alternative channels to use for requests matching specific patterns.
Example data (YAML):
"Channels" is an array, containing at least one sub-array, "Trigger". Stored in that sub-array, each "pattern" matches against the beginning of the URL of the request, serving as a "trigger" for identifying alternative channels. Each "trigger" should have its own corresponding sub-array, containing any number of groups of potential sub-matches, each containing any potential alternative channels. The provided "alternative channels" will replace the part of the URL of the request which matches the corresponding sub-match, and a subsequent new request will be made using the amended URL. You can also just ignore this property entirely if you don't want to utilise alternative channels at your implementation. Disabled property.A CSV listing any alternative channels that should be disabled for the request (useful, for example, if you have a static list of alternative channels for your implementation, but provide the ability for end-users to optionally disable channels of their choice).
Example (per the earlier provided example):
SendToOut property.Whether to send the results of outbound requests to stdout (useful for debugging, but most likely won't ever be needed in production).
ObjLogger property.Object-level logger for the results of outbound requests (useful for debugging potential problems with outbound requests at the implementation).
ObjLoggerFile property.Whether to dump the object-level logger to a file (and where to find it).
Proxy property.The URL of a proxy to use if required by the instance.
ProxyAuth property.The username and password to use if required by the specified proxy URL.
UserAgent property.The default user agent to cite when sending requests (for the sake of good netiquette and politeness towards any endpoints you intend to communicate with, this should definitely be populated when implementing the class according to your implementation).
MostRecentStatusCode property.Whenever a request is performed, the status code returned by that request will be populated to this property (e.g., 200, 403, 404, etc).
request method.The main request method (this is what you'll want to use to actually perform a request).
The first parameter ( The second parameter ( The third parameter ( The fourth parameter ( The fifth parameter ( The sixth parameter ( The method returns a string (either the returned resource, or an empty string on failure). The class also implements the magic method
inCsv method.Checks for a value within comma-separated values (CSV). Returns true when the value is found and false otherwise. This is used internally to process the
sendMessage method.When
Last Updated: 2 July 2025 (2025.07.02). |