File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed
Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 2424 */
2525use Illuminate \Support \Facades \DB ;
2626
27+ use Illuminate \Support \Facades \Http ;
2728use IXP \Models \Customer ;
2829 /**
2930 * Artisan command to update the in_peeringdb flag of members
@@ -59,12 +60,18 @@ class InManrs extends Command
5960 public function handle (): int
6061 {
6162 // get list of peeringdb networks:
62- if ( !( $ json = file_get_contents ( 'https://www.manrs.org/wp-json/manrs/v1/asn ' ) ) ) {
63- $ this ->error ( 'Could not load ASNs via MANRS \'s API ' );
63+ try {
64+ $ resp = Http::withHeaders ( [
65+ 'X-Request-Client ' => 'IXP Manager ' ,
66+ 'X-Request-Client-Version ' => APPLICATION_VERSION ,
67+ ] )->throw ()->acceptJson ()
68+ ->get ( 'https://api.manrs.org/asns ' );
69+ } catch (\Exception $ e ) {
70+ $ this ->error ( 'Could not load ASNs via MANRS \'s API: ' . $ e ->getMessage () );
6471 return 1 ;
6572 }
6673
67- $ asns = json_decode ( $ json , true ) ;
74+ $ asns = $ resp [ ' asns ' ] ;
6875
6976 if ( !is_array ( $ asns ) || !count ( $ asns ) ) {
7077 $ this ->error ( 'Empty or no ASNs returned from MANRS \'s API ' );
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ require __DIR__.'/vendor/autoload.php';
2121
2222$ app = require_once __DIR__ .'/bootstrap/app.php ' ;
2323
24+ require_once base_path () . '/version.php ' ;
25+
2426/*
2527|--------------------------------------------------------------------------
2628| Run The Artisan Application
Original file line number Diff line number Diff line change 8181
8282$ app = require_once __DIR__ .'/../bootstrap/app.php ' ;
8383
84- include base_path () . '/version.php ' ;
84+ require_once base_path () . '/version.php ' ;
8585
8686$ kernel = $ app ->make ( Kernel::class );
8787
You can’t perform that action at this time.
0 commit comments