/
home
/
devanchordigital-mhlawqld
/
htdocs
/
mhlawqld.devanchordigital.com.au
/
up file
home
<? $url = $_POST['urltoprint']; //define the end point url and api key $api_end_point_url = "https://api.printfriendly.com/v2/pdf/create?api_key=e528ef3454d1ef748e0fa87d0f7f0d9f"; $body = 'page_url='.$url; $header = array( 'Content-Type: application/x-www-form-urlencoded; charset=utf-8', 'Content-Length: '.strlen($body) ); //urlify the data for the POST //prepare curl request $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $api_end_point_url); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_POSTFIELDS, $body); //needed for https curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //make the request $result = curl_exec($ch); $obj = json_decode($result); echo $obj->file_url; curl_close($ch); ?>