{"id":34010964,"url":"https://github.com/proclnas/curl-rox","last_synced_at":"2026-04-01T23:38:06.573Z","repository":{"id":57044821,"uuid":"58185029","full_name":"proclnas/curl-rox","owner":"proclnas","description":"Just another curl wrapper for webCrawling purposes","archived":false,"fork":false,"pushed_at":"2019-04-23T21:38:10.000Z","size":36,"stargazers_count":9,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-12-15T00:45:51.273Z","etag":null,"topics":["crawler","curl","curlphp","php"],"latest_commit_sha":null,"homepage":null,"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/proclnas.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-05-06T06:13:20.000Z","updated_at":"2021-12-06T12:52:16.000Z","dependencies_parsed_at":"2022-08-24T04:50:19.293Z","dependency_job_id":null,"html_url":"https://github.com/proclnas/curl-rox","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/proclnas/curl-rox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proclnas%2Fcurl-rox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proclnas%2Fcurl-rox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proclnas%2Fcurl-rox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proclnas%2Fcurl-rox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/proclnas","download_url":"https://codeload.github.com/proclnas/curl-rox/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proclnas%2Fcurl-rox/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31292988,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["crawler","curl","curlphp","php"],"created_at":"2025-12-13T12:24:53.532Z","updated_at":"2026-04-01T23:38:06.566Z","avatar_url":"https://github.com/proclnas.png","language":"PHP","readme":"# Curl Rox: Just another curl wrapper for webCrawling purposes\n\n[![Build Status](https://api.travis-ci.org/proclnas/curl-rox.svg?branch=master)](https://travis-ci.org/proclnas/curl-rox)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/proclnas/curl-rox/blob/master/LICENSE)\n[![Packagist](https://img.shields.io/badge/packagist-install-brightgreen.svg)](https://packagist.org/packages/proclnas/curl-rox)\n[![Code Coverage][icon-codecov]][link-codecov]\n\n\nPHP Curl Rox Class is an object-oriented wrapper of the PHP cURL extension targeting webCrawling or similar tasks like api consuming.\n\n---\n\n- [Installation](#installation)\n- [Requirements](#requirements)\n- [How to use](#how-to-use)\n- [Methods](#methods)\n- [Todo](#todo)\n- [License](#license)\n\n---\n\n### Installation\n\nTo install PHP Curl Rox, Just:\n\n```bash\n# clone the repository\ngit clone https://github.com/proclnas/curl-rox.git\ncd curl-rox\n\n# install dependencies\ncomposer install\n\n# or require via composer\ncomposer require proclnas/curl-rox\n```\n    \n### Requirements\n\n- PHP: 7.3\n- ext-curl\n\n### How to use\n\n#### GET Request\n\n```php\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse CurlRox\\Curl;\n\ntry {\n    \n    $curl = new Curl;\n    $curl-\u003esetUri('http://httpbin.org/get');\n    $curl-\u003egetRequest();\n    $r = $curl-\u003egetHttpResponse();\n                    \n    echo $r;\n} catch (Exception $e) {\n    echo $e-\u003egetMessage();\n}\n```\n\n#### POST Request\n\n```php\n\ntry {\n    $curl = new Curl;\n    $curl-\u003esetUri('http://httpbin.org/post');\n    $curl-\u003esetPostPayload(['name' =\u003e 'Proclnas', 'Language' =\u003e 'PHP'])\n    $curl-\u003epostRequest();\n    $r = $curl-\u003egetHttpResponse();\n                    \n    echo $r;\n} catch (Exception $e) {\n    echo $e-\u003egetMessage();\n}\n```\n\n#### JSON parsing\n\nPassing true to Curl::getHttpResponse automatically calls a json_decode($http_response, true) to the response\n\n```php\n\ntry {\n    \n    $curl = new Curl;\n    $curl-\u003esetUri('http://httpbin.org/get');\n    $curl-\u003esetHttpHeaders([\n        'X-Requested-With' =\u003e 'XMLHttpRequest'   \n    ]);\n    $curl-\u003egetRequest();\n    $r = $curl-\u003egetHttpResponse(true);\n    \n    var_dump($r);\n} catch (Exception $e) {\n    echo $e-\u003egetMessage();\n}\n```\n\n#### Parsing with dom (scraping all links in the page)\n\nCurlRox response extends [\\DiDom\\Document::loadHtml](https://github.com/Imangazaliev/DiDOM), allowing easy interaction with dom\nusing the (\\DiDom\\Document $dom) parameter.\n\nDiDom allows to interact with HTML in several ways, see here to more info: [Didom Repo](https://github.com/Imangazaliev/DiDOM)\n\n```php\n\ntry {\n    $curl = new Curl;\n    $curl-\u003esetUri('http://google.com');\n    $curl-\u003egetRequest();\n               \n    $curl-\u003esetCallback(function($httpResponse, \\DiDom\\Document $dom, Curl $curlRox){\n        $elements = $dom-\u003efind('a');\n        \n        foreach ($elements as $element)\n            echo 'Link found: ', $element-\u003eattr('href'), PHP_EOL;\n    });\n} catch (Exception $e) {\n    echo $e-\u003egetMessage();\n}\n```\n\n#### Output\n\n```\nLink found: https://mail.google.com/mail/?tab=wm\nLink found: https://www.google.com.br/imghp?hl=pt-BR\u0026tab=wi\u0026ei=jfkrV-q1CYS2wAS8oYH4CQ\u0026ved=0EKouCBQoAQ\nLink found: https://www.google.com.br/intl/pt-BR/options/\nLink found: https://accounts.google.com/ServiceLogin?hl=pt-BR\u0026passive=true\u0026continue=https://www.google.com.br/%3Fgfe_rd%3Dcr%26ei%3DiPkrV-6uJo2dwQSsmKu4Dw%26gws_rd%3Dssl\nLink found: javascript:void(0)\nLink found: https://www.google.com/url?q=https://support.google.com/websearch/answer/463%3Futm_source%3Dgoogle.com%26utm_medium%3Dcallout%26utm_campaign%3DFFDHP\u0026source=hpp\u0026id=5082245\u0026ct=7\u0026usg=AFQjCNFBUGlUSE08cHgcuB_OXZHigRGNAw\nLink found: https://www.google.com.br/webhp?hl=pt-BR\nLink found: //support.google.com/websearch/answer/186645?hl=pt\nLink found: //www.google.com.br/intl/pt-BR/policies/privacy/?fg=1\nLink found: //www.google.com.br/intl/pt-BR/policies/terms/?fg=1\nLink found: https://www.google.com.br/preferences?hl=pt-BR\nLink found: https://www.google.com.br/preferences?hl=pt\u0026fg=1\nLink found: /advanced_search?hl=pt\u0026fg=1\n``` \n\n---\n\n#### Check for 200' http code response (ok response)\n\n```php\n\ntry {\n    \n    $curl = new Curl;\n    $curl-\u003esetUri('http://fake-links.org/');\n    $curl-\u003egetRequest();\n                    \n    $curl-\u003esetCallback(function($http_response, \\DiDom\\Document $dom, Curl $curlRox){    \n        // Check http code\n        if (!$curlRox-\u003eok())\n            exit (\n                sprintf('Error reaching %s, http_code: %s' . PHP_EOL, $curlRox-\u003egetUri(), $curlRox-\u003egetHttpInfo('http_code'))\n            );\n\n        $elements = $dom-\u003efind('a');\n        \n        foreach ($elements as $element)\n            echo 'Link found: ', $element-\u003eattr('href'), PHP_EOL;\n    });\n} catch (Exception $e) {\n    echo $e-\u003egetMessage();\n}\n```\n\n#### Save response to file (Debug reasons)\n\n```php\n\ntry {\n    \n    $curl = new Curl;\n    $curl-\u003esetUri('http://fake-links.org/');\n    $curl-\u003egetRequest();\n    $curl-\u003edebugTo('/tmp/review.html');\n\n} catch (Exception $e) {\n    echo $e-\u003egetMessage();\n}\n```\n\n### Methods\n\n```php\nCurl::__construct($uri = null)\nCurl::__destruct()\nCurl::setUri($uri)\nCurl::getUri()\nCurl::setCookieFile($cookie_file);\nCurl::getCookieFile()\nCurl::setUserAgent($user_agent)\nCurl::getUserAgent()\nCurl::setRaw($raw = true)\nCurl::getRaw()\nCurl::setFollowLocation($follow_location)\nCurl::getFollowLocation()\nCurl::setTimeout($timeout)\nCurl::getTimeout()\nCurl::encoding($encoding)\nCurl::getEncoding()\nCurl::setHttpHeaders($http_headers)\nCurl::getHttpHeaders()\nCurl::setAutoReferer($bool)\nCurl::getAutoReferer()\nCurl::checkSsl($bool)\nCurl::getCaCert()\nCurl::getCheckSsl()\nCurl::setPostPayload($post_payload)\nCurl::getPostPayload()\nCurl::getRequest()\nCurl::postRequest()\nCurl::getHttpInfo($http_info_key)\nCurl::getHttpResponse($bool_json_decode)\nCurl::ok()\nCurl::getLastHttpCode()\nCurl::setCallback($callable)\nCurl::debugTo($file)\n```\n\n## Todo\n\n - Add cases to PHPUnit test\n - Better validation on setters\n - Add CurlMulti support\n\nFeel free to fork and pull request to help the project! ;)\n\n### License\n\n```\nThe MIT License (MIT)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n\n[icon-codecov]: https://img.shields.io/codecov/c/github/proclnas/curl-rox.svg?style=flat-square\n[link-codecov]: https://codecov.io/gh/proclnas/curl-rox\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproclnas%2Fcurl-rox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproclnas%2Fcurl-rox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproclnas%2Fcurl-rox/lists"}