I've run into a strange issue. 

I have a few simple lines CURL code for calling an api service. This code runs perfectly fine when running outisde of Drupal (in php file in browser and cli), but when the file is included within Drupal (after the bootstrap), it operates deferentially.

Under normal condition, the result returned by the API service has many results, but when run within Drupal, it only returns one result.

I suspect Drupal is changing a setting that CURL is using, which is changing how the API is understanding the call.

Does anyone know what the problem might be caused by?

Here is the code:

    $params = array(
      'domain' => array(
        'www.domain1.com',
        'www.domain2.info',
        'www.domain3.in.th',
        'www.domain4.com',
        'www.domain5.in',
      )
    );
    
    $ch = curl_init();
    curl_setopt_array($ch, array(
      CURLOPT_URL => 'http://api.postrank.com/v2/domain/activity?appkey=123456&format=json',
      CURLOPT_HEADER => false,
      CURLOPT_CONNECTTIMEOUT => 30,
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_SSL_VERIFYPEER => false,
      CURLOPT_POST => true,
      CURLOPT_POSTFIELDS => http_build_query($params)
    ));
    $response = curl_exec($ch);
    $err = curl_errno($ch);
    curl_close($ch);
    
    print_r($response);