protected function determineMethod($curl, $method) {
    $method = strtoupper($method);

    switch ($method) {
      case 'GET':
        curl_setopt($curl, CURLOPT_HTTPGET, TRUE);
        break;
      case 'HEAD':
        curl_setopt($curl, CURLOPT_NOBODY, TRUE);
        break;

      // Put is problematic: Some PUT requests might not have
      // a body.
      case 'PUT':
        curl_setopt($curl, CURLOPT_PUT, TRUE);
        break;

      // We use customrequest for post because we are
      // not submitting form data.
      case 'POST':
      case 'DELETE':
      case 'COPY':
      default:
        curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
    }

  }
protected function determineMethod($curl, $method) {
    $method = strtoupper($method);

    switch ($method) {
      case 'GET':
        curl_setopt($curl, CURLOPT_HTTPGET, TRUE);
        break;
      case 'HEAD':
        curl_setopt($curl, CURLOPT_NOBODY, TRUE);
        break;

      // Put is problematic: Some PUT requests might not have
      // a body.
      case 'PUT':
        curl_setopt($curl, CURLOPT_PUT, TRUE);
        break;

      // We use customrequest for post because we are
      // not submitting form data.
      case 'POST':
      case 'DELETE':
      case 'COPY':
      default:
        curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
    }

  }
protected function determineMethod ( $ curl , $ method ) { $ method = strtoupper ( $ method ) ; switch ( $ method ) { case 'GET' : curl_setopt ( $ curl , CURLOPT_HTTPGET , TRUE ) ; break ; case 'HEAD' : curl_setopt ( $ curl , CURLOPT_NOBODY , TRUE ) ; break ; // Put is problematic: Some PUT requests might not have // a body. case 'PUT' : curl_setopt ( $ curl , CURLOPT_PUT , TRUE ) ; break ; // We use customrequest for post because we are // not submitting form data. case 'POST' : case 'DELETE' : case 'COPY' : default : curl_setopt ( $ curl , CURLOPT_CUSTOMREQUEST , $ method ) ; } }
Set the appropriate constant on the CURL object.

Curl handles method name setting in a slightly counter-intuitive
way, so we have a special function for setting the method
correctly. Note that since we do not POST as www-form-*, we
use a custom post.

@param resource $curl
A curl object.
@param string $method
An HTTP method name.
Set the appropriate constant on the CURL object .