Can someone help me as to why my PHP post isn't working?
$url = 'https://example.com/portal/api/create';
$data = array('api_key' => 'my_api_key', 'firstname' => 'test', 'surname' => 'test', 'email' => 'test@test.com', 'notes' => 'notes', 'phonecell' => '123456789');
$options = array(
'http' => array(
'header' => "Content-type: multipart/form-data\r\n",
'method' => 'POST',
'content' => http_build_query($data),
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) {
echo $result;
}
I've tested this in postman and it works fine but when I send over a PHP post it looks like I get the error 'invalid API key' Should there be any reason that PHP file_get_contents
would do anything weird here?