Skip to content

Instantly share code, notes, and snippets.

@pasindud
Created December 26, 2014 16:08
Show Gist options
  • Select an option

  • Save pasindud/aa7925368419a76d3dd9 to your computer and use it in GitHub Desktop.

Select an option

Save pasindud/aa7925368419a76d3dd9 to your computer and use it in GitHub Desktop.
Ideamart Subscription Snippet
<?php
$url = "http://api.dialog.lk:8080/subscription/send";
subcribe('APP_005755','asda',$address);
function subcribe($url,$appid,$pw,$sub){
$arrayField = array("applicationId" => $appid,
"password" => $pw,
"subscriberId" => $sub,
"version"=>"1.0",
"action"=>"1"
);
$jsonStream = json_encode($arrayField);
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch,CURLOPT_POSTFIELDS, $jsonStream);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
$res = curl_exec($ch);
curl_close($ch);
return json_decode($res);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment