{"id":16060778,"url":"https://github.com/geerlingguy/request","last_synced_at":"2025-03-16T07:32:36.176Z","repository":{"id":44464062,"uuid":"12738243","full_name":"geerlingguy/Request","owner":"geerlingguy","description":"A simple PHP HTTP request class.","archived":false,"fork":false,"pushed_at":"2021-12-15T19:06:18.000Z","size":22,"stargazers_count":60,"open_issues_count":0,"forks_count":27,"subscribers_count":11,"default_branch":"1.x","last_synced_at":"2025-03-15T23:03:42.416Z","etag":null,"topics":["curl","library","packagist","php","request"],"latest_commit_sha":null,"homepage":"http://www.midwesternmac.com/request","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geerlingguy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-10T19:19:04.000Z","updated_at":"2024-06-02T16:54:58.000Z","dependencies_parsed_at":"2022-09-22T03:42:59.877Z","dependency_job_id":null,"html_url":"https://github.com/geerlingguy/Request","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2FRequest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2FRequest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2FRequest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2FRequest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geerlingguy","download_url":"https://codeload.github.com/geerlingguy/Request/tar.gz/refs/heads/1.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243806070,"owners_count":20350775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["curl","library","packagist","php","request"],"created_at":"2024-10-09T04:06:22.565Z","updated_at":"2025-03-16T07:32:35.881Z","avatar_url":"https://github.com/geerlingguy.png","language":"PHP","readme":"\u003cimg src=\"https://raw.githubusercontent.com/geerlingguy/Request/1.x/Resources/Request-Logo.png\" alt=\"Request for PHP Logo\" /\u003e\n\n# Request\n\nA simple PHP HTTP request class.\n\nThis class includes many convenience methods to help take the headache out of\ndealing with HTTP requests in PHP.\n\n## Usage\n\nInclude the class (`\\JJG\\Request`) using an autoloader, then build a new Request\nobject, execute the request, and get the response.\n\n```php\n$request = new Request('http://www.example.com/');\n$request-\u003eexecute();\n$response = $request-\u003egetResponse();\n```\n\nOther parameters you can retrieve after executing a request include:\n\n```php\n// The full headers from the response.\n$request-\u003egetHeader();\n// The latency for this response, in ms.\n$request-\u003egetLatency();\n// The HTTP status code (e.g. 200 for 200 OK).\n$request-\u003egetHttpCode();\n// Empty if no error present, otherwise shows any cURL errors.\n$request-\u003egetError();\n```\n\nThere are also other convenient methods included for other purposes.\n\n```php\n// Returns TRUE if 'string' exists in the response.\n$request-\u003echeckResponseForContent('string');\n```\n\nYou can also make requests with basic HTTP authentication:\n\n```php\n// Execute a request with HTTP basic authentication.\n$request = new Request('http://www.example.com/secure-page');\n$request-\u003esetBasicAuthCredentials('username', 'password');\n$request-\u003eexecute();\n```\n\nOther options include enabling or disabling SSL, using cookies, and setting cURL\ntimeout values:\n\n```php\n// Enable Cookies.\n$request-\u003eenableCookies($cookie_file_path);\n// Enable SSL/TLS.\n$request-\u003eenableSSL();\n// Set the user agent string.\n$request-\u003euserAgent = 'User agent string here.';\n// Set the initial connection timeout (default is 10 seconds).\n$request-\u003econnectTimeout = 5;\n// Set the timeout (default is 15 seconds).\n$request-\u003etimeout = 10;\n// Send some fields as a POST request.\n$request-\u003esetRequestType('POST');\n$request-\u003esetPostFields($field_array);\n```\n\nSee the Request class variable definitions and methods for more\ndetails and documentation.\n\n## Why Request?\n\nI've used other HTTP request libraries for PHP before, but often fall back to\nusing cURL directly, because the libraries I've used are too complicated for my\nneeds. This library aims to be a very simple and easy-to-use wrapper around\ncURL, and should be easy to pick up for anyone familiar with cURL usage in PHP.\n\nSome other recommended HTTP libraries for PHP include:\n\n  - [Guzzle](http://guzzlephp.org/)\n  - [Httpful](http://phphttpclient.com/)\n  - [Zend_Http](http://framework.zend.com/manual/1.12/en/zend.http.html)\n  - [Unirest](https://github.com/mashape/unirest-php)\n  - [Requests](https://github.com/rmccue/Requests)\n\n## License\n\nRequest is licensed under the MIT (Expat) license. See included LICENSE.md.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeerlingguy%2Frequest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeerlingguy%2Frequest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeerlingguy%2Frequest/lists"}