PHP code example of ankitjain28may / hackerearth-api
1. Go to this page and download the library: Download ankitjain28may/hackerearth-api library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ankitjain28may / hackerearth-api example snippets
Ankitjain28may\HackerEarth\HackerEarthServiceProvider::class,
'HackerEarth' => Ankitjain28may\HackerEarth\Facades\HackerEarth::class,
return [
/*
|--------------------------------------------------------------------------
| HackerEarth API KEY
|--------------------------------------------------------------------------
|
| https://api.hackerearth.com/v3/code/
| https://api.hackerearth.com/v3/code/
|
*/
'api_key' => env('HACKEREARTH_SECRET_KEY', 'CLIENT_SECRET_KEY'),
];
$data = [
"lang" => '',
"source" => '',
"input" => '',
"async" => 0, // default (1 => async req and 0 => sync req)
"callback" => '',
'id' => '',
'time_limit' => 5, // default
'memory_limit' => 262144, // default
]
use Ankitjain28may\HackerEarth\HackerEarth;
$config = [
"api_key" => 'hackerearth_app_key',
];
$hackerearth = new HackerEarth($config);
$data = [
"lang" => 'php',
"source" => ' echo "hello World!";
use Ankitjain28may\HackerEarth\Facades\HackerEarth;
use Ankitjain28may\HackerEarth\Models\Output;
//..
//..
$data = [
"lang" => 'php',
"source" => ' echo "hello World!";
use Ankitjain28may\HackerEarth\Facades\HackerEarth;
use Ankitjain28may\HackerEarth\Models\Output;
//..
//..
$data = [
"lang" => 'php',
"source" => ' echo "hello World!";
use Ankitjain28may\HackerEarth\Facades\HackerEarth;
//..
//..
$data = [
"lang" => 'php',
"source" => realpath("test.txt")
];
$result = HackerEarth::RunFile([$data]);
$result = HackerEarth::CompileFile([$data]);
php artisan vendor:publish --provider="Ankitjain28may\HackerEarth\HackerEarthServiceProvider"
php artisan vendor:publish --tag=migrations