Why the request work in Postman but no in my php file

thank you for this helpfull society.
I have an API that require a Token that’s taken based on my IP address. So, I tried to send a post request to the API through Postman and everything works fine, but when I try to send the request through a php file by my localhost, it gives me 500 statuc code – internal server error.

this is my code

require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl(Some Api URL);
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'some token key' => 'some token value based on my IP address'
));
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}

I expect to get a status of 200 not 500 and internal server error