{"id":16883958,"url":"https://github.com/jabranr/php-curl","last_synced_at":"2025-09-09T01:41:41.102Z","repository":{"id":56995341,"uuid":"70435990","full_name":"jabranr/php-curl","owner":"jabranr","description":"Simple PHP client for cURL operations","archived":false,"fork":false,"pushed_at":"2018-01-27T00:46:37.000Z","size":15,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-05-24T05:12:28.756Z","etag":null,"topics":["composer","curl","php-client","php-curl"],"latest_commit_sha":null,"homepage":"","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/jabranr.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":"2016-10-09T23:15:57.000Z","updated_at":"2019-10-14T09:12:37.000Z","dependencies_parsed_at":"2022-08-21T13:50:33.324Z","dependency_job_id":null,"html_url":"https://github.com/jabranr/php-curl","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/jabranr/php-curl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabranr%2Fphp-curl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabranr%2Fphp-curl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabranr%2Fphp-curl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabranr%2Fphp-curl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jabranr","download_url":"https://codeload.github.com/jabranr/php-curl/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabranr%2Fphp-curl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274232035,"owners_count":25245856,"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","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["composer","curl","php-client","php-curl"],"created_at":"2024-10-13T16:15:54.990Z","updated_at":"2025-09-09T01:41:41.077Z","avatar_url":"https://github.com/jabranr.png","language":"PHP","readme":"# PHP cURL [![Build Status](https://travis-ci.org/jabranr/php-curl.svg?branch=master)](https://travis-ci.org/jabranr/php-curl) [![Latest Stable Version](https://poser.pugx.org/jabranr/php-curl/v/stable.svg)](https://packagist.org/packages/jabranr/php-curl) [![Total Downloads](https://poser.pugx.org/jabranr/php-curl/downloads.svg)](https://packagist.org/packages/jabranr/php-curl)\n\nA simple PHP client for cURL operations.\n\n\u003e __Migrating from v1?__ Beware that v2 has breaking changes! Some of the API methods names have changed.\n\nSimply import the library into your project. The best way to do so is to use [Composer](http://getcomposer.org) as following. Otherwise it can simply be downloaded from GitHub and added to the project.\n\n```shell\n$ composer require jabranr/php-curl\n```\n\nStart using it straight away. (Following example assumes that it was installed via Composer)\n\n```php\n\u003c?php\n\nrequire 'path/to/vendor/autoload.php';\n\nuse Jabran\\HttpUtil\\HttpCurlRequest;\nuse Jabran\\HttpUtil\\Exception\\HttpCurlException;\n\n# Start new cURL request\n$curl = new HttpCurlRequest('http://jabran.me');\n```\n\nSetting cURL options\n```php\n\u003c?php\n\n# Set options - method 1\n$curl-\u003esetOption(CURLOPT_RETURNTRANSFER, true);\n$curl-\u003esetOption(CURLOPT_FOLLOWLOCATION, true);\n\n# Set options - method 2\n$curl-\u003esetOptions(array(\n    CURLOPT_RETURNTRANSFER =\u003e true,\n    CURLOPT_FOLLOWLOCATION =\u003e true\n));\n\n# Execute request, get response and close connection\ntry {\n    $response = $curl-\u003eexecute();\n} catch(HttpCurlException $e) {\n    $curl-\u003egetErrorCode(); // -\u003e cURL error number\n    $curl-\u003egetErrorMessage(); // -\u003e cURL error message\n    \n    # OR\n    \n    $e-\u003egetMessage(); // -\u003e cURL error: [ErrorCode] ErrorMessage\n}\n\n# OR get more info and close connection manually\ntry {\n    $response = $curl-\u003eexecute(false);\n} catch(HttpCurlException $e) { }\n\n# Get response later\n$response = $curl-\u003egetResponse();\n\n# \n$info = $curl-\u003egetInfo();\n\n# Close request\n$curl-\u003eclose();\n```\n\n\n# API\n\nThe cURL class exposes following API:\n\n#### `getInfo`\n\nGet cURL request info. `$option` needs to be a valid cURL constant. If none given then it will return an associative array.\n\n```php\n$curl-\u003eexecute(false);\n$curl-\u003egetInfo($option = null);\n$curl-\u003eclose();\n```\n\n\n#### `getError`\n\nGet cURL request error message.\n\n```php\n$curl-\u003egetError();\n```\n\n\n#### `getErrorCode`\n\nGet cURL request error code.\n\n```php\n$curl-\u003egetErrorCode();\n```\n\n\n#### `getErrorMessage`\n\nGet cURL request error message.\n\n```php\n$curl-\u003egetErrorMessage();\n```\n\n\n#### `getHttpCode`\n\nGet cURL request HTTP status code.\n\n```php\n$curl-\u003egetHttpCode();\n```\n\n\n#### `getTotalTime`\n\nGet total time taken for a cURL request.\n\n```php\n$curl-\u003egetTotalTime();\n```\n\n\n#### `getResponse`\n\nGet response for a cURL request.\n\n```php\n$curl-\u003egetResponse();\n```\n\n\n# License\nFeel free to use and send improvements via pull requests. Licensed under the MIT License.\n\n\u0026copy; Jabran Rafique \u0026ndash; 2016 \u0026ndash; 2017\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjabranr%2Fphp-curl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjabranr%2Fphp-curl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjabranr%2Fphp-curl/lists"}