How to convert developers Box.View script to PHP curl() format

I am trying to convert the following scripts supplied in this tutorial to a PHP curl() format:

Supplied script

curl \\
-H "Authorization: Token YOUR_API_KEY" \\
-H "Content-Type: application/json" \\
-d '{"url": ""}' \\
echo $xxx;

Desired script

$json       = array ();
$jsonheader = array 
"Accept: application/json",
"Content-type:  application/json", 
"Authorization: TOKEN API-KEY"

$url = ''
     . '?Authorization= TOKEN API=KEY';

curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, 1 );                 // howmany parameter to post
    curl_setopt($ch, CURLOPT_POSTFIELDS, $json ); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );    // don't give anything back 
    curl_setopt($ch, CURLOPT_HEADER, TRUE );            // need this to evaluate the response .. 
    curl_setopt($ch, CURLOPT_VERBOSE, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $jsonheader ); // it is httpheader not httpheader"s" 

    $output = curl_exec($ch); 

    $msg = '<br />Operation completed without any errors (only in my dreams)';
    if(curl_exec($ch) === false)
      $msg = '<br />Curl error: ' . curl_error($ch);
    echo $msg;  

I managed with a little help from my son who found the following:

GitHub Resource:

PDF Source File:

HTML Conversion: