{"id":36980545,"url":"https://github.com/screenshotmachine/screenshotmachine-php","last_synced_at":"2026-01-13T22:50:17.854Z","repository":{"id":57048104,"uuid":"198408378","full_name":"screenshotmachine/screenshotmachine-php","owner":"screenshotmachine","description":"Simple example how to call screenshot machine's API using PHP.","archived":false,"fork":false,"pushed_at":"2019-08-26T08:55:14.000Z","size":8,"stargazers_count":4,"open_issues_count":1,"forks_count":4,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-06T02:29:26.657Z","etag":null,"topics":["fullpage-screenshot","html-to-pdf","html2pdf","pdf-converter","pdf-generator","php-library","render-service","screenshot","screenshot-generator","screenshots","thumbnail-generator","thumbnails","web-to-print","webpage-capture","webpage-screenshot","webpage2pdf","website-screenshot","website-snapshot","website-thumbnail","website-to-pdf"],"latest_commit_sha":null,"homepage":"https://www.screenshotmachine.com","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/screenshotmachine.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-07-23T10:32:18.000Z","updated_at":"2023-04-21T00:09:06.000Z","dependencies_parsed_at":"2022-08-23T17:50:23.321Z","dependency_job_id":null,"html_url":"https://github.com/screenshotmachine/screenshotmachine-php","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/screenshotmachine/screenshotmachine-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screenshotmachine%2Fscreenshotmachine-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screenshotmachine%2Fscreenshotmachine-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screenshotmachine%2Fscreenshotmachine-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screenshotmachine%2Fscreenshotmachine-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/screenshotmachine","download_url":"https://codeload.github.com/screenshotmachine/screenshotmachine-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screenshotmachine%2Fscreenshotmachine-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28402157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"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":["fullpage-screenshot","html-to-pdf","html2pdf","pdf-converter","pdf-generator","php-library","render-service","screenshot","screenshot-generator","screenshots","thumbnail-generator","thumbnails","web-to-print","webpage-capture","webpage-screenshot","webpage2pdf","website-screenshot","website-snapshot","website-thumbnail","website-to-pdf"],"created_at":"2026-01-13T22:50:17.228Z","updated_at":"2026-01-13T22:50:17.848Z","avatar_url":"https://github.com/screenshotmachine.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# screenshotmachine-php\n\nCaptures website screenshot and converts website to PDF using Screenshot machine - online website screenshot generator and website to PDF converter.\n\n## Installation\n\na) using Composer - package manager for PHP\n```php\nphp composer.phar require screenshotmachine/screenshotmachine-php\n```\nb) or download source code directly from GitHub.com\n\nFirst, you need to create a free/premium account at [www.screenshotmachine.com](https://www.screenshotmachine.com) website. After registration, you will see your customer key in your user profile. Also secret phrase is maintained here. Please, use secret phrase always, when your API calls are called from publicly available websites.  \n\nSet-up your customer key and secret phrase (if needed) in the script:\n\n```php\n$customer_key = \"PUT_YOUR_CUSTOMER_KEY_HERE\";\n$secret_phrase = \"\"; //leave secret phrase empty, if not needed\n```\n\n## Website screenshot API\nSet additional options to fulfill your needs: \n\n```php\n//mandatory parameter\n$options['url'] = \"https://www.google.com\";\n\n// all next parameters are optional, see our website screenshot API guide for more details\n$options['dimension'] = \"1366x768\";  // or \"1366xfull\" for full length screenshot\n$options['device'] = \"desktop\";\n$options['format'] = \"png\";\n$options['cacheLimit'] = \"0\";\n$options['delay'] = \"200\";\n$options['zoom'] = \"100\";\n```\nMore info about options can be found in our [Website screenshot API](https://www.screenshotmachine.com/website-screenshot-api.php).  \n\n\n#### Sample code\n\n\n```php\n\u003c?php\n$customer_key = \"PUT_YOUR_CUSTOMER_KEY_HERE\";\n$secret_phrase = \"\"; //leave secret phrase empty, if not needed\n\n$machine = new ScreenshotMachine($customer_key, $secret_phrase);\n\n//mandatory parameter\n$options['url'] = \"https://www.google.com\";\n\n// all next parameters are optional, see our website screenshot API guide for more details\n$options['dimension'] = \"1366x768\";  // or \"1366xfull\" for full length screenshot\n$options['device'] = \"desktop\";\n$options['format'] = \"png\";\n$options['cacheLimit'] = \"0\";\n$options['delay'] = \"200\";\n$options['zoom'] = \"100\";\n\n$api_url = $machine-\u003egenerate_screenshot_api_url($options);\n\n//put link to your html code\necho '\u003cimg src=\"' . $api_url . '\"\u003e' . PHP_EOL;\n```\nGenerated ```api_url```  link can be placed in ```\u003cimg\u003e``` tag or used in your business logic later.\n\nIf you need to store captured screenshot as an image, just call:\n\n```php\n\u003c?php\n$customer_key = \"PUT_YOUR_CUSTOMER_KEY_HERE\";\n$secret_phrase = \"\"; //leave secret phrase empty, if not needed\n\n$machine = new ScreenshotMachine($customer_key, $secret_phrase);\n\n//mandatory parameter\n$options['url'] = \"https://www.google.com\";\n\n// all next parameters are optional, see our website screenshot API guide for more details\n$options['dimension'] = \"1366x768\";  // or \"1366xfull\" for full length screenshot\n$options['device'] = \"desktop\";\n$options['format'] = \"png\";\n$options['cacheLimit'] = \"0\";\n$options['delay'] = \"200\";\n$options['zoom'] = \"100\";\n\n$api_url = $machine-\u003egenerate_screenshot_api_url($options);\n\n//save screenshot as an image\n$output_file = 'output.png';\nfile_put_contents($output_file, file_get_contents($api_url));\necho 'Screenshot saved as ' . $output_file . PHP_EOL;\n```\n\nCaptured screenshot will be saved as ```output.png``` file in current directory.\n\n## Website to PDF API\n\nSet the PDF options: \n```php\n//mandatory parameter\n$options['url'] = \"https://www.google.com\";\n\n// all next parameters are optional, see our website to PDF API guide for more details\n$options['paper'] = \"letter\";\n$options['orientation'] = \"portrait\";\n$options['media'] = \"print\";\n$options['bg'] = \"nobg\";\n$options['delay'] = \"2000\";\n$options['scale'] = \"50\";\n```\nMore info about options can be found in our [Website to PDF API](https://www.screenshotmachine.com/website-to-pdf-api.php).  \n#### Sample code\n```php\n$customer_key = \"PUT_YOUR_CUSTOMER_KEY_HERE\";\n$secret_phrase = \"\"; //leave secret phrase empty, if not needed\n\n$machine = new ScreenshotMachine($customer_key, $secret_phrase);\n\n//mandatory parameter\n$options['url'] = \"https://www.google.com\";\n\n// all next parameters are optional, see our website to PDF API guide for more details\n$options['paper'] = \"letter\";\n$options['orientation'] = \"portrait\";\n$options['media'] = \"print\";\n$options['bg'] = \"nobg\";\n$options['delay'] = \"2000\";\n$options['scale'] = \"50\";\n\n$pdf_api_url = $machine-\u003egenerate_pdf_api_url($options);\n\n//save PDF file\n$output_file = 'output.pdf';\nfile_put_contents($output_file, file_get_contents($pdf_api_url));\necho 'PDF saved as ' . $output_file . PHP_EOL;\n```\nCaptured PDF will be saved as ```output.pdf``` file in the current directory.\n# License\n\nThe MIT License (MIT)    ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscreenshotmachine%2Fscreenshotmachine-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscreenshotmachine%2Fscreenshotmachine-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscreenshotmachine%2Fscreenshotmachine-php/lists"}