API rest returning 405 php

0

I'm running the following code:

<?php

  $data_string['MerchantOrderId']                             = "2014111703";
  $data_string['Customer']['Name']                            = "Comprador Teste";
  $data_string['Payment']['Type']                             = "CreditCard";           
  $data_string['Payment']['Amount']                           = '15700';
  $data_string['Payment']['Provider']                         = "Simulado";
  $data_string['Payment']['Installments']                     = '1';
  $data_string['Payment']['CreditCard']['CardNumber']         = "1234123412341231";
  $data_string['Payment']['CreditCard']['Holder']             = "Teste Holder";
  $data_string['Payment']['CreditCard']['ExpirationDate']     = "12/2021";
  $data_string['Payment']['CreditCard']['SecurityCode']       = "123";
  $data_string['Payment']['CreditCard']['Brand']              = "Visa";

  $data_string = json_encode($data_string);

  $data = json_encode($data_string);

$ch = curl_init('https://apihomolog.braspag.com.br/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'MerchantId: 1688adsasdasdasdasdasda',
'MerchantKey: adasdasdasdsadasdaswoT')
);

$result = curl_exec($ch);

echo '<pre>';
print_r($result);

The API is returning: 405 - HTTP verb used to access this page is not allowed.

How do I see the response without the error?

    
asked by anonymous 21.04.2016 / 03:52

0 answers