Help on CURL Json

0

I have a curl code, which pulls json through the url, but is giving a bug that I can not solve, can anyone help me?

<?php
$c = curl_init();
$login = 'LOGIN';
$key = 'KEY';
$file = $_GET["fileid"];
curl_setopt($c, CURLOPT_URL, "https://api.openload.io/1/file/dlticket?file={$file}&login={$login}&key={$key}");
curl_setopt($c,  CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($c);
$response = json_decode($response);
$output = get_object_vars($response);
$result = get_object_vars($output['result']);
$ticket = $result['ticket'];
$captcha = $result['captcha_url'];
curl_setopt($c, CURLOPT_URL, "https://api.openload.io/1/file/dl?file={$file}&ticket={$ticket}&captcha_response={$captcha}");
curl_setopt($c,  CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($c);
$response = json_decode($response);
$output = get_object_vars($response);
$downloadOutput = get_object_vars($output['result']);
$downloadLink = $downloadOutput['url'];
header("Location:  $downloadLink");
// If no File name is provided then this form is used
 $pageName = basename($_SERVER['PHP_SELF']);
if (empty($file)) {
echo '
<html>
	<body>
		<form action="' . $pageName . '" method="get">
		Enter the File ID: <input type="text" name="fileid"><br>
		<input type="submit">
		</form>
	</body>
</html>
';
}
?>

Error:

Warning: get_object_vars() expects parameter 1 to be object, null given in C:\AppServ\www\novo.php on line 10
    
asked by anonymous 23.05.2018 / 02:55

0 answers