{"id":37232283,"url":"https://github.com/denis-kisel/php-casper-curl","last_synced_at":"2026-01-15T03:48:24.617Z","repository":{"id":56965468,"uuid":"216151316","full_name":"denis-kisel/php-casper-curl","owner":"denis-kisel","description":"PHP library basics on casperjs and phantomjs for get content difficult sites","archived":false,"fork":false,"pushed_at":"2020-01-31T10:29:46.000Z","size":387,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-27T14:50:34.023Z","etag":null,"topics":["casperjs","curl","laravel","phantomjs","php"],"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/denis-kisel.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":"2019-10-19T04:55:15.000Z","updated_at":"2023-10-30T15:04:41.000Z","dependencies_parsed_at":"2022-08-21T11:20:08.742Z","dependency_job_id":null,"html_url":"https://github.com/denis-kisel/php-casper-curl","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/denis-kisel/php-casper-curl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denis-kisel%2Fphp-casper-curl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denis-kisel%2Fphp-casper-curl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denis-kisel%2Fphp-casper-curl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denis-kisel%2Fphp-casper-curl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denis-kisel","download_url":"https://codeload.github.com/denis-kisel/php-casper-curl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denis-kisel%2Fphp-casper-curl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28419236,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["casperjs","curl","laravel","phantomjs","php"],"created_at":"2026-01-15T03:48:23.679Z","updated_at":"2026-01-15T03:48:24.604Z","avatar_url":"https://github.com/denis-kisel.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Casper CURL\n\nBasics on [casperjs](https://casperjs.org/) / [phantomjs](https://phantomjs.org/) libs for get content difficult sites.\n\n## Installation\n\n1 Install global casperjs and phantomjs\n```bash\nnpm install -g casperjs\nnpm install -g phantomjs\n\n# If phantomjs is running with errors\nnpm install -g phantomjs --ignore-scripts\n```\n\n2 Install CasperCURL package\n```bash\ncomposer require denis-kisel/casper-curl\n```\n\n### Publish Configuration File(If Use Laravel)\nIf you use another framework or native PHP, just skip this setting.\n```bash\nphp artisan vendor:publish --provider=\"DenisKisel\\CasperCURL\\ServiceProvider\" --tag=\"config\"\n```\n\n## Usage\nSimple example\n\n```php\n//Return content page\n$casperCURL = new \\DenisKisel\\CasperCURL\\CasperCURL($storageDir);\n$response = $casperCURL-\u003eto('https://google.com')-\u003erequest()\n```\n\n### Set Method\nmethod($method)  \nMethods available: `GET|POST|PUT|DELETE`  \nBy default use `GET`\n\n```php\n$casperCURL = new \\DenisKisel\\CasperCURL\\CasperCURL($storageDir);\n$response = $casperCURL-\u003eto('https://google.com')\n    -\u003emethod('POST')\n    -\u003erequest()\n```\n\n### Set Data\nwithData($arrayData)  \n\n```php\n$casperCURL = new \\DenisKisel\\CasperCURL\\CasperCURL($storageDir);\n$response = $casperCURL-\u003eto('https://google.com')\n    -\u003ewithData([\n        'login' =\u003e '***',\n        'pass' =\u003e '***'\n    ])\n    -\u003emethod('POST')\n    -\u003erequest()\n```\n\n### Set Headers\nwithHeaders($arrayHeaders)  \n\n```php\n$casperCURL = new \\DenisKisel\\CasperCURL\\CasperCURL($storageDir);\n$response = $casperCURL-\u003eto('https://google.com')\n    -\u003ewithHeaders([\n        'User-Agent' =\u003e 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0',\n        'Accept' =\u003e 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'\n    ])\n    -\u003erequest()\n```\n\n### Set UserAgent\nuserAgent($userAgent)  \nBy default use: Mozilla/5.0 (Windows NT 10.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36\n\n```php\n$casperCURL = new \\DenisKisel\\CasperCURL\\CasperCURL($storageDir);\n$response = $casperCURL-\u003eto('https://google.com')\n    -\u003euserAgent('Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0')\n    -\u003erequest()\n```\n\n### Use Proxy\nwithProxy($ip, $port \\[, $method = 'http'] \\[, $login = null] \\[, $pass = null])\n\nMethods available: `http|socks5|none`\n\n```php\n$casperCURL = new \\DenisKisel\\CasperCURL\\CasperCURL($storageDir);\n$response = $casperCURL-\u003eto('https://google.com')\n    -\u003ewithProxy($ip, $port)\n    -\u003erequest()\n```\n\n### Use Cookies\nwithCookie($fileName, \\[, $dir])  \nBy default cookie is `disabled`.  \nBy default cookies file is stored in storage dir.\n\n```php\n$casperCURL = new \\DenisKisel\\CasperCURL\\CasperCURL($storageDir);\n$response = $casperCURL-\u003eto('https://google.com')\n    -\u003ewithCookie('cookie.txt')\n    -\u003erequest()\n```\n\n### Use WindowSize(ViewPort)\nwindowSize($with, $height)  \nBy default: width/height: `1920/1080` px\n\n```php\n$casperCURL = new \\DenisKisel\\CasperCURL\\CasperCURL($storageDir);\n$response = $casperCURL-\u003eto('https://google.com')\n    -\u003ewindowSize(320, 600)\n    -\u003erequest()\n```\n\n### Phantom Cli Options\nSet custom phantom cli options  \nList of available options: [Phantom Options Doc](https://phantomjs.org/api/command-line.html)\n\nwithPhantomOptions($arrayOptions)  \nKey of option `must not contain` a prefix `--`\n\n```php\n$options = [\n    'debug' =\u003e 'true',\n    'ignore-ssl-errors' =\u003e 'true'\n];\n\n$casperCURL = new \\DenisKisel\\CasperCURL\\CasperCURL($storageDir);\n$response = $casperCURL-\u003eto('https://google.com')\n    -\u003ewithPhantomOptions($options)\n    -\u003erequest()\n```\n\n## CasperJS\nFor use dynamic handling content  \n[Casper Doc](http://casperjs.org/)\n\n### Use Casper Then\ncasperThen($jsScript)  \n[DOC](http://docs.casperjs.org/en/latest/modules/casper.html#then)\n\n```php\n$casperCURL = new \\DenisKisel\\CasperCURL\\CasperCURL($storageDir);\n$response = $casperCURL-\u003eto('http://google.fr')\n    -\u003ecasperThen('\n         this.fill('form[action=\"/search\"]', { q: 'casperjs' }, true);\n         this.wait(2000, function () {\n             this.capture('step_1.png');\n         });\n     \n    ')\n    -\u003erequest()\n```\n\n### Use Custom Casper JS\nCustom casper body js  \n[DOC](http://docs.casperjs.org/en/1.1-beta2/index.html)\n\n```php\n$casperCURL = new \\DenisKisel\\CasperCURL\\CasperCURL($storageDir);\n$response = $casperCURL-\u003eto('http://google.fr')\n    -\u003ecustomCasper('\n        casper.then(function() {\n             this.fill('form[action=\"/search\"]', { q: 'casperjs' }, true);\n             this.wait(2000, function () {\n                 this.capture('step_1.png');\n             });\n        });\n    ')\n    -\u003erequest()\n```\n\n## Debug\nenableDebug()  \nWill be store response data and capture in storage dir\n\n```php\n$casperCURL = new \\DenisKisel\\CasperCURL\\CasperCURL($storageDir);\n$response = $casperCURL-\u003eto('http://google.com')\n    -\u003eenableDebug()\n    -\u003erequest()\n```\n\n## Response\nResponse is object with fields:\n* status (exp. 200|404|500)\n* content (string html|dom|txt)\n\n```php\n$casperCURL = new \\DenisKisel\\CasperCURL\\CasperCURL($storageDir);\n$response = $casperCURL-\u003eto('http://google.com')\n    -\u003erequest();\n    \n$response-\u003estatus;\n$response-\u003econtent;\n```\n\n### Response Content\nBy default request response full page content  \n[DOC](http://docs.casperjs.org/en/latest/modules/casper.html#getpagecontent)\n\nBut response can override by `output` variable\n\n```php\n$casperCURL = new \\DenisKisel\\CasperCURL\\CasperCURL($storageDir);\n$response = $casperCURL-\u003eto('http://google.fr')\n    -\u003ecasperThen('\n         this.fill('form[action=\"/search\"]', { q: 'casperjs' }, true);\n         this.wait(2000, function () {\n             this.capture('step_1.png');\n         });\n         \n         output = console.log('Override default output!');\n    ')\n    -\u003erequest()\n```\n\n## Use In Laravel\n\n```php\n$response = \\DenisKisel\\CasperCURL\\LCasperCURL::to('https://google.com')-\u003erequest()\n```\n\n## License\nThis package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT)\n\n## Contact\nDeveloper: Denis Kisel\n* Email: denis.kisel92@gmail.com\n* Skype: live:denis.kisel92\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenis-kisel%2Fphp-casper-curl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenis-kisel%2Fphp-casper-curl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenis-kisel%2Fphp-casper-curl/lists"}