{"id":21597372,"url":"https://github.com/cleantalk/http-lib","last_synced_at":"2025-03-18T11:25:32.969Z","repository":{"id":61691959,"uuid":"486514332","full_name":"CleanTalk/http-lib","owner":"CleanTalk","description":"Standalone HTTP library","archived":false,"fork":false,"pushed_at":"2022-10-19T07:09:36.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-28T22:51:42.695Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CleanTalk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-28T08:46:54.000Z","updated_at":"2023-09-21T05:48:03.000Z","dependencies_parsed_at":"2022-10-20T05:15:27.732Z","dependency_job_id":null,"html_url":"https://github.com/CleanTalk/http-lib","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/CleanTalk%2Fhttp-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanTalk%2Fhttp-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanTalk%2Fhttp-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanTalk%2Fhttp-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CleanTalk","download_url":"https://codeload.github.com/CleanTalk/http-lib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244209474,"owners_count":20416287,"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":[],"created_at":"2024-11-24T18:08:50.778Z","updated_at":"2025-03-18T11:25:32.950Z","avatar_url":"https://github.com/CleanTalk.png","language":"PHP","readme":"\u003ca href=\"https://cleantalk.org\" target=\"_blank\"\u003e\u003cimg src=\"https://ps.w.org/cleantalk-spam-protect/assets/icon-256x256.png\" alt=\"CleanTalk\" width=\"150\"\u003e\u003c/a\u003e\n\nCleantalk HTTP Requests\n===================\n\nStandalone PHP HTTP Request library\n\n### Description\nThis standalone library allowing you to use different HTTP-requests in easy way.\nIt could be simply merged into your project. Please, see \"Usage\" to learn more.  \n\n### Features\n\n- POST, GET HTTP-methods.\n- Multiple requests.\n- Asynchronous requests.\n- Callback functions.\n- CURL options support.\n- Any combination of the above features.\n\n### Usage\nDownload and include the file into your project by using PSR-0 (autoload) or directly attaching the files with \"include\" instruction.\nUse the following code to use the Request:\n\n    $request = new Cleantalk\\Common\\HTTP\\Request();\n    $request_result = $request\n        -\u003esetUrl('example.com')\n        -\u003esetData(['foo' =\u003e 'bar']])\n        -\u003esetPresets(['async', 'ssl']))\n        -\u003erequest();\nYou can reuse once created object change it URL and callback functions any time:\n\n    $another_request_result = $request\n        -\u003esetUrl($new_url)\n        -\u003esetCallback(\n            function ($response_content, $requested_url){\n                $processed_response_content = strreplace(\n                    'Hello',\n                    'Hey!',\n                    $response_content\n                ); \n                \n                return $processed_response_content;\n            })\n        -\u003erequest();\nOr use a multiple async requests. This one will send asynchronous requests to example.com and exapme2.com wth custom user-agent and pass the response direct to the output buffer:\n\n    $miltiple_request = new Cleantalk\\Common\\HTTP\\Request();\n    $multiple_request_result = $request\n        -\u003esetUrl(['example.com', 'example2.com'])\n        -\u003esetData(['foo' =\u003e 'bar']])\n        -\u003esetPresets(['async']))\n        -\u003esetOptions([\n            CURLOPT_RETURNTRANSFER =\u003e fase,                  // CURL format is supported\n            'user-agent'           =\u003e 'My custom User-Agent' // And user-friendly\n            ])\n        -\u003erequest();\n        \n## Presets\nThe lib is using presets which allow you to configure its behaviour.\nUse 'setPresets()' method to set them.\n\n    -\u003esetPresets([\n            'async',\n            'get',\n            'dont_follow_redirects'\n        ])\n\nMay use the following presets (you can combine them in any way you want):\n+ dont_follow_redirects - ignore 300-family response code and don't follow redirects\n+ get_code              - getting only HTTP response code\n+ async                 - async requests. Sends request and return 'true' value. Doesn't wait for response.\n+ get                   - makes GET-type request instead of default POST-type\n+ ssl                   - uses SSL\n+ cache                 - allow caching for this request\n+ retry_with_socket     - make another request with socket if cURL failed to retrieve data\n\n## Options\nIf you need to precise tune you could use 'setOptions' method:\n\n    -\u003esetOptions([\n            CURLOPT_RETURNTRANSFER =\u003e fase,                  // CURL format is supported\n            'user-agent'           =\u003e 'My custom User-Agent' // And user-friendly\n        ])\nIt supports any cURL type options(learn more in [cURL documentation](https://www.php.net/curl_setopt)) and the following human-friendly:\n+ timeout         - maximum connection duration(int)\n+ sslverify       - verify host (bool)\n+ sslcertificates - pass your own SSL certificate (string)\n+ headers         - any custom headers (array of strings)\n+ user-agent      - custom user-agent (string)\n\n## License\nThis library is open-sourced software licensed under the [GPLv3 license](http://www.gnu.org/licenses/gpl-3.0.html).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleantalk%2Fhttp-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcleantalk%2Fhttp-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleantalk%2Fhttp-lib/lists"}