diff --git a/src/Request.php b/src/Request.php index 43d5d0d..a383189 100644 --- a/src/Request.php +++ b/src/Request.php @@ -55,9 +55,7 @@ public static function fromConsumerAndToken( $defaults['oauth_token'] = $token->key; } - if (isset($parameters['batch'])) { - $parameters = array_merge($defaults, ['oauth_body_hash' => base64_encode(sha1($parameters['batch'], true))]); - } elseif (isset($parameters['raw'])) { + if (isset($parameters['raw'])) { $parameters = array_merge($defaults, ['oauth_body_hash' => base64_encode(sha1($parameters['raw'], true))]); } elseif (empty($parameters)) { $parameters = array_merge($defaults, ['oauth_body_hash' => base64_encode(sha1('', true))]); diff --git a/src/TwitterAds.php b/src/TwitterAds.php index ec2ab89..54e5b75 100644 --- a/src/TwitterAds.php +++ b/src/TwitterAds.php @@ -627,8 +627,10 @@ private function request($url, $method, $authorization, $postfields, $headers = $options[CURLOPT_POST] = true; if (isset($postfields['raw'])) { $options[CURLOPT_POSTFIELDS] = $postfields['raw']; - } else if (isset($postfields['batch'])) { - $options[CURLOPT_POSTFIELDS] = $postfields['batch']; + $options[CURLOPT_HTTPHEADER] = array_merge($options[CURLOPT_HTTPHEADER], [ + 'Content-Type: application/json', + 'Content-Length: '. strlen($postfields['raw']) + ]); } else { $options[CURLOPT_POSTFIELDS] = Util::buildHttpQuery($postfields); }