original_string: public function executeRequest(Google_Http_Request $request) {
          $curl = new curl();
  
          if ($request->getPostBody()) {
              $curl->setopt(array('CURLOPT_POSTFIELDS' => $request->getPostBody()));
          }
  
          $requestHeaders = $request->getRequestHeaders();
          if ($requestHeaders && is_array($requestHeaders)) {
              $curlHeaders = array();
              foreach ($requestHeaders as $k => $v) {
                  $curlHeaders[] = "$k: $v";
              }
              $curl->setopt(array('CURLOPT_HTTPHEADER' => $curlHeaders));
          }
  
          $curl->setopt(array('CURLOPT_URL' => $request->getUrl()));
  
          $curl->setopt(array('CURLOPT_CUSTOMREQUEST' => $request->getRequestMethod()));
          $curl->setopt(array('CURLOPT_USERAGENT' => $request->getUserAgent()));
  
          $curl->setopt(array('CURLOPT_FOLLOWLOCATION' => false));
          $curl->setopt(array('CURLOPT_SSL_VERIFYPEER' => true));
          $curl->setopt(array('CURLOPT_RETURNTRANSFER' => true));
          $curl->setopt(array('CURLOPT_HEADER' => true));
  
          if ($request->canGzip()) {
              $curl->setopt(array('CURLOPT_ENCODING' => 'gzip,deflate'));
          }
  
          $curl->setopt($this->options);
          $respdata = $this->do_request($curl, $request);
  
          $infos = $curl->get_info();
          $respheadersize = $infos['header_size'];
          $resphttpcode = (int) $infos['http_code'];
          $curlerrornum = $curl->get_errno();
          $curlerror = $curl->error;
  
          if ($respdata != CURLE_OK) {
              throw new Google_IO_Exception($curlerror);
          }
  
          list($responseHeaders, $responseBody) = $this->parseHttpResponse($respdata, $respheadersize);
          return array($responseBody, $responseHeaders, $resphttpcode);
      }
code: public function executeRequest(Google_Http_Request $request) {
          $curl = new curl();
  
          if ($request->getPostBody()) {
              $curl->setopt(array('CURLOPT_POSTFIELDS' => $request->getPostBody()));
          }
  
          $requestHeaders = $request->getRequestHeaders();
          if ($requestHeaders && is_array($requestHeaders)) {
              $curlHeaders = array();
              foreach ($requestHeaders as $k => $v) {
                  $curlHeaders[] = "$k: $v";
              }
              $curl->setopt(array('CURLOPT_HTTPHEADER' => $curlHeaders));
          }
  
          $curl->setopt(array('CURLOPT_URL' => $request->getUrl()));
  
          $curl->setopt(array('CURLOPT_CUSTOMREQUEST' => $request->getRequestMethod()));
          $curl->setopt(array('CURLOPT_USERAGENT' => $request->getUserAgent()));
  
          $curl->setopt(array('CURLOPT_FOLLOWLOCATION' => false));
          $curl->setopt(array('CURLOPT_SSL_VERIFYPEER' => true));
          $curl->setopt(array('CURLOPT_RETURNTRANSFER' => true));
          $curl->setopt(array('CURLOPT_HEADER' => true));
  
          if ($request->canGzip()) {
              $curl->setopt(array('CURLOPT_ENCODING' => 'gzip,deflate'));
          }
  
          $curl->setopt($this->options);
          $respdata = $this->do_request($curl, $request);
  
          $infos = $curl->get_info();
          $respheadersize = $infos['header_size'];
          $resphttpcode = (int) $infos['http_code'];
          $curlerrornum = $curl->get_errno();
          $curlerror = $curl->error;
  
          if ($respdata != CURLE_OK) {
              throw new Google_IO_Exception($curlerror);
          }
  
          list($responseHeaders, $responseBody) = $this->parseHttpResponse($respdata, $respheadersize);
          return array($responseBody, $responseHeaders, $resphttpcode);
      }
code_tokens: public function executeRequest ( Google_Http_Request $ request ) { $ curl = new curl ( ) ; if ( $ request -> getPostBody ( ) ) { $ curl -> setopt ( array ( 'CURLOPT_POSTFIELDS' => $ request -> getPostBody ( ) ) ) ; } $ requestHeaders = $ request -> getRequestHeaders ( ) ; if ( $ requestHeaders && is_array ( $ requestHeaders ) ) { $ curlHeaders = array ( ) ; foreach ( $ requestHeaders as $ k => $ v ) { $ curlHeaders [ ] = "$k: $v" ; } $ curl -> setopt ( array ( 'CURLOPT_HTTPHEADER' => $ curlHeaders ) ) ; } $ curl -> setopt ( array ( 'CURLOPT_URL' => $ request -> getUrl ( ) ) ) ; $ curl -> setopt ( array ( 'CURLOPT_CUSTOMREQUEST' => $ request -> getRequestMethod ( ) ) ) ; $ curl -> setopt ( array ( 'CURLOPT_USERAGENT' => $ request -> getUserAgent ( ) ) ) ; $ curl -> setopt ( array ( 'CURLOPT_FOLLOWLOCATION' => false ) ) ; $ curl -> setopt ( array ( 'CURLOPT_SSL_VERIFYPEER' => true ) ) ; $ curl -> setopt ( array ( 'CURLOPT_RETURNTRANSFER' => true ) ) ; $ curl -> setopt ( array ( 'CURLOPT_HEADER' => true ) ) ; if ( $ request -> canGzip ( ) ) { $ curl -> setopt ( array ( 'CURLOPT_ENCODING' => 'gzip,deflate' ) ) ; } $ curl -> setopt ( $ this -> options ) ; $ respdata = $ this -> do_request ( $ curl , $ request ) ; $ infos = $ curl -> get_info ( ) ; $ respheadersize = $ infos [ 'header_size' ] ; $ resphttpcode = ( int ) $ infos [ 'http_code' ] ; $ curlerrornum = $ curl -> get_errno ( ) ; $ curlerror = $ curl -> error ; if ( $ respdata != CURLE_OK ) { throw new Google_IO_Exception ( $ curlerror ) ; } list ( $ responseHeaders , $ responseBody ) = $ this -> parseHttpResponse ( $ respdata , $ respheadersize ) ; return array ( $ responseBody , $ responseHeaders , $ resphttpcode ) ; }
docstring: Execute an API request.
  
  This is a copy/paste from the parent class that uses Moodle's implementation
  of curl. Portions have been removed or altered.
  
  @param Google_Http_Request $request the http request to be executed
  @return Google_Http_Request http request with the response http code, response
  headers and response body filled in
  @throws Google_IO_Exception on curl or IO error
docstring_tokens: Execute an API request .