Created
September 3, 2018 18:40
-
-
Save mscoutermarsh/b6e4c6aeee50817e5ef681d4874addc7 to your computer and use it in GitHub Desktop.
php convert html/css to image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
$html = "<div class='ping'>Pong ✅</div>"; | |
$css = ".ping { padding: 20px; font-family: 'sans-serif'; }"; | |
// Retrieve user_id/api_key from https://htmlcsstoimage.com/dashboard | |
$client = new GuzzleHttp\Client(); | |
$res = $client->request('POST', 'https://hcti.io/v1/image', [ | |
'auth' => ['user_id', 'api_key'], | |
'form_params' => ['html' => $html, 'css' => $css] | |
]); | |
echo $res->getBody(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment