Hiren Kukadiya

Print HTML to PDF

$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, “https://api.printfriendly.com/v1/pdfs/create”); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, “html='<html><body><h1>Title</h1><p>Text“); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_USERPWD, “4ad92b944e0de703b54b2076f4efdabe” . “:” . “”); $headers = array(); $headers[] = “Content-Type: application/x-www-form-urlencoded”; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); if (curl_errno($ch)) { echo ‘Error:’ . curl_error($ch); } curl_close ($ch); echo “</br>Result</br>”; print($result);die; For the...Read more …