AnsweredAssumed Answered

How do I use the library Akamai OpenEdge grid-php via browser without command line?

Question asked by Daniel Vieira on Sep 29, 2016
Latest reply on Oct 4, 2016 by Fredrik Klasen

How do I use the library Akamai OpenEdge grid-php via browser without command line?

I can not excutar scripts using this lib via browser, generates errors because other libs like "Climate of league" and ETC also use.

 

A simple example:

<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);
require_once __DIR__.'/cli/init.php';

 

 

try{
$client = \Akamai\Open\EdgeGrid\Client::createFromEdgeRcFile('default', 'path/.edgerc');//this path is fake
$response = $client->get('/alerts/v1/portal-user?status=active'); //An endpoint any
$response = json_decode($response->getBody(), true);
}catch(Exception $e){
echo 'Ocorreu um erro durante a requisicao: '.$e->getMessage(),"\n"."Code: ".$e->getCode().PHP_EOL;
}
print_r($response).PHP_EOL;

 

error:

Got error 'PHP message: PHP Notice: Undefined index: argv in PATH/cli/init.php on line 45
PHP message: PHP Warning: array_shift() expects parameter 1 to be array, null given in /vendor/league/climate/src/Argument/Parser.php on line 274
PHP message: PHP Warning: in_array() expects parameter 2 to be array, null given in /vendor/league/climate/src/Argument/Parser.php on line 52
PHP message: PHP Catchable fatal error: Argument 1 passed to League\\CLImate\\Argument\\Parser::prefixedArguments() must be of the type array, null given, called in /vendor/league/climate/src/Argument/Parser.php on line 56 and defined in vendor/league/climate/src/Argument/Parser.php on line 134\n'
I know what it is for the argv [http://php.net/manual/pt_BR/reserved.variables.argv.php], but this leaves me stuck to always run the scripts from the command line?

Outcomes