original_string: public function request_accesskey() {
          global $CFG, $USER;
  
          require_once($CFG->libdir . '/filelib.php');
  
          // Sending the request access key request to Airnotifier.
          $serverurl = $CFG->airnotifierurl . ':' . $CFG->airnotifierport . '/accesskeys/';
          // We use an APP Key "none", it can be anything.
          $header = array('Accept: application/json', 'X-AN-APP-NAME: ' . $CFG->airnotifierappname,
              'X-AN-APP-KEY: none');
          $curl = new curl();
          $curl->setHeader($header);
  
          // Site ids are stored as secrets in md5 in the Moodle public hub.
          $params = array(
              'url' => $CFG->wwwroot,
              'siteid' => md5($CFG->siteidentifier),
              'contact' => $USER->email,
              'description' => $CFG->wwwroot
              );
          $resp = $curl->post($serverurl, $params);
  
          if ($key = json_decode($resp, true)) {
              if (!empty($key['accesskey'])) {
                  return $key['accesskey'];
              }
          }
          debugging("Unexpected response from the Airnotifier server: $resp");
          return false;
      }
code: public function request_accesskey() {
          global $CFG, $USER;
  
          require_once($CFG->libdir . '/filelib.php');
  
          // Sending the request access key request to Airnotifier.
          $serverurl = $CFG->airnotifierurl . ':' . $CFG->airnotifierport . '/accesskeys/';
          // We use an APP Key "none", it can be anything.
          $header = array('Accept: application/json', 'X-AN-APP-NAME: ' . $CFG->airnotifierappname,
              'X-AN-APP-KEY: none');
          $curl = new curl();
          $curl->setHeader($header);
  
          // Site ids are stored as secrets in md5 in the Moodle public hub.
          $params = array(
              'url' => $CFG->wwwroot,
              'siteid' => md5($CFG->siteidentifier),
              'contact' => $USER->email,
              'description' => $CFG->wwwroot
              );
          $resp = $curl->post($serverurl, $params);
  
          if ($key = json_decode($resp, true)) {
              if (!empty($key['accesskey'])) {
                  return $key['accesskey'];
              }
          }
          debugging("Unexpected response from the Airnotifier server: $resp");
          return false;
      }
code_tokens: public function request_accesskey ( ) { global $ CFG , $ USER ; require_once ( $ CFG -> libdir . '/filelib.php' ) ; // Sending the request access key request to Airnotifier. $ serverurl = $ CFG -> airnotifierurl . ':' . $ CFG -> airnotifierport . '/accesskeys/' ; // We use an APP Key "none", it can be anything. $ header = array ( 'Accept: application/json' , 'X-AN-APP-NAME: ' . $ CFG -> airnotifierappname , 'X-AN-APP-KEY: none' ) ; $ curl = new curl ( ) ; $ curl -> setHeader ( $ header ) ; // Site ids are stored as secrets in md5 in the Moodle public hub. $ params = array ( 'url' => $ CFG -> wwwroot , 'siteid' => md5 ( $ CFG -> siteidentifier ) , 'contact' => $ USER -> email , 'description' => $ CFG -> wwwroot ) ; $ resp = $ curl -> post ( $ serverurl , $ params ) ; if ( $ key = json_decode ( $ resp , true ) ) { if ( ! empty ( $ key [ 'accesskey' ] ) ) { return $ key [ 'accesskey' ] ; } } debugging ( "Unexpected response from the Airnotifier server: $resp" ) ; return false ; }
docstring: Request and access key to Airnotifier
  
  @return mixed The access key or false in case of error
docstring_tokens: Request and access key to Airnotifier