<?php

include_once("functions.php");

$headers  =  array( "Accept:" );
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$payload = array();
//$payload['url'] = urldecode($_REQUEST['url']);

$payload['url'] = urldecode($root. "/mod.php?p=payment&a=statement&an=10012&key=d31b414483");
$payload['renderType'] = "pdf";
$payload = json_encode($payload);

$url = 'http://PhantomJScloud.com/api/browser/v2/ak-3df0c-s2595-dnqy9-ps7xg-7q3e4/';
//$payload = file_get_contents ( 'request.json' );
$options = array(
    'http' => array(
        'header'  => "Content-type: application/json\r\n",
        'method'  => 'POST',
        'content' => $payload
    )
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) { /* Handle error */ }
file_put_contents('content.pdf',$result);



 ?>
