This project is not maintained anymore and is abandoned. Feel free to fork and make your own changes if needed.
Thanks to everyone for their valuable feedback and contributions.
A flexible wrapper PHP class for the cURL extension.
composer require crazy-max/cws-curl
And download the code:
composer install # or update
See tests/test.php
file sample to help you.
reset - Reset.
process - Start the cURL request.
getUrl - The URL to fetch.
setUrl - Set the URL to fetch.
getMethod - The HTTP request method.
setDeleteMethod - Set DELETE HTTP request method.
setGetMethod - Set GET HTTP request method. (default)
setHeadMethod - Set HEAD HTTP request method.
setPostMethod - Set POST HTTP request method.
setPutMethod - Set PUT HTTP request method.
getParams - Query string parameters.
addParam - Add a custom parameter to the cURL request.
addOption - Add an option for the cURL transfer.
getTimeout - The maximum number of seconds to allow cURL functions to execute.
setTimeout - Set the maximum number of seconds to allow cURL functions to execute.
getReferer - The contents of the "Referer: " header to be used in a HTTP request.
setReferer - Set the contents of the "Referer: " header to be used in a HTTP request.
getUserAgent - The contents of the "User-Agent: " header to be used in a HTTP request.
setChromeUseragent - Set the Chrome User-Agent to the contents of the "User-Agent: " header to be used in a HTTP request.
setFirefoxUseragent - Set the Firefox User-Agent to the contents of the "User-Agent: " header to be used in a HTTP request.
setGooglebotUseragent - Set the Googlebot User-Agent to the contents of the "User-Agent: " header to be used in a HTTP request.
setIeUseragent - Set the Internet Explorer User-Agent to the contents of the "User-Agent: " header to be used in a HTTP request.
setOperaUseragent - Set the Opera User-Agent to the contents of the "User-Agent: " header to be used in a HTTP request.
setUserAgent - Set The contents of the "User-Agent: " header to be used in a HTTP request.
getUsername - The username for the CURLOPT_USERPWD option.
getPassword - The password associated to the username for the CURLOPT_USERPWD option.
setAuth - Set authentication to the cURL request with username and password.
isRedirect - Redirects allowed.
setRedirect - Set allow redirects.
getMaxRedirect - Maximum redirects allowed.
setMaxRedirect - Set the maximum redirects allowed.
getProxyHost - The host IP of the proxy to connect to.
getProxyPort - The port number of the proxy to connect to.
getProxyType - The proxy type CURLPROXY_HTTP, CURLPROXY_SOCKS4 or CURLPROXY_SOCKS5.
setProxy - Set a HTTP proxy to tunnel requests through.
getProxyAuthType - The HTTP authentication method(s) to use for the proxy connection. Can be CURLAUTH_BASIC or CURLAUTH_NTLM.
getProxyUsername - The username for the CURLOPT_PROXYUSERPWD option.
getProxyPassword - The password associated to the proxyUsername for the CURLOPT_PROXYUSERPWD option.
setProxyAuth - Set a HTTP proxy authentication.
getSession - The current cURL session.
getStatus - The HTTP status code returned.
getContent - The content transferred.
getInfos - The cURL information regarding the transfer.
getHeaderFulltext - The header fulltext response.
getHeaders - The headers response.
getError - Get the last error.
All kinds of contributions are welcome 🙌! The most basic way to show your support is to star 🌟 the project, or to raise issues 💬 You can also support this project by becoming a sponsor on GitHub 👏 or by making a Paypal donation to ensure this journey continues indefinitely! 🚀
Thanks again for your support, it is much appreciated! 🙏
MIT. See LICENSE
for more details.