[✔] Neue API - Cannot use object of type stdClass as array
Grüßt Euch,
ich weiß jetzt, nicht ob es an mir liegt oder an der API. Ich gehe aber von Ersteres aus und bitte um Hilfe.
Ich dachte das würde eventuell helfen, aber scheinbar kann eine Klasse nicht verwendet werden?
Zitat:
Notice: file_get_contents(): Content-type not specified assuming application/x-www-form-urlencoded in D:\wamp\apache2\htdocs\xxx\includes\functions.php on line 112
Fatal error: Uncaught Error: Cannot use object of type stdClass as array in D:\wamp\apache2\htdocs\ssbgv2\includes\functions.p hp:117 Stack trace: #0 D:\wamp\apache2\htdocs\xxx\game.php(40): filecryptCC('http://ul.to/te...', '7985f3f72278079...', 'abb076e3ec08f6b...') #1 {main} thrown in D:\wamp\apache2\htdocs\xxx\includes\functions.php on line 117
PHP-Code:
function filecryptCC($links, $api, $foldername)
{
define('YES', 1);
define('NO', 0);
$USE_SSL = true;
$api_key = $api;
$name = $foldername;
$group = "";
$mirror_1 = $links;
$postdata = http_build_query(array(
"fn" => "containerV2",
"sub" => "create",
"api_key" => $api_key,
"name" => $name,
"mirror_1" => $mirror_1,
"captcha" => YES,
"allow_cnl" => YES,
"allow_dlc" => YES,
"allow_links" => NO,
"group" => $group,
));
$opts = array('http' => array(
"method" => "POST",
"content" => $postdata,
));
$context = stream_context_create($opts);
$result = file_get_contents('http' . (($USE_SSL) ? 's' : '') . '://www.filecrypt.cc/api.php', false, $context);
if (!$result) {
throw new Exception("filecrypt.cc api down");
} else {
$json = json_decode($result);
$fc_link = $json->container[0]->link;
$fc_simg = $json->container[0]->bigimg;
}
$fc_array = array(
$fc_link,
$fc_simg,
);
return ($fc_array);
}