Direct to Card - Cellfire PHP SOAP API interaction example

Hi, one of our clients decided to implement Cellfire Direct to Card coupons. To start using this api you need to get wsdl file url and two http headers values Api-Key and tlc.

After you get these parameters please use code below to connect to Cellfire SOAP API. I spent some time to realize how to do it. I hope it will save your time.

Thank you

//Please wrote code!
$params = array (
    'trace' => 1,
    'cache_wsdl' => WSDL_CACHE_NONE,
    'stream_context' =>
      stream_context_create(
        array(
          'http' => array(
            'header' =>
// Please note! There is a space between secrets values and :
              'Api-Key: your_secret_key' . PHP_EOL .
              'tlc: your_secret_tlc' . PHP_EOL,
          )
        )
      )
  );

  $client = new SoapClient('http://path_to_external_wsdl_file', $params);
print_r($client->getMerchantsAndOffers());

// You can also review raw HTTP request and response.
// To make it use following functions.
$client->__getLastRequestHeaders();
$client->__getLastResponseHeaders();
$client->__getLastRequest();
$client->__getLastResponse();

// To get full list of SOAP server supported function use.
$client->__getFunctions();