Skip to content

Instantly share code, notes, and snippets.

@korrio
Last active August 29, 2015 14:25
Show Gist options
  • Select an option

  • Save korrio/36a8e616fe0a9a16a7a4 to your computer and use it in GitHub Desktop.

Select an option

Save korrio/36a8e616fe0a9a16a7a4 to your computer and use it in GitHub Desktop.
notifySocial
public static function notifySocial($from_id,$from_name,$to_id,$type,$post_id,$all=false)
{
$TYPES_likeFeed = 100;
$TYPES_commentFeed = 101;
$TYPES_shareFeed = 102;
$TYPES_reportFeed = 103;
$TYPES_liveNow = 200; // ??
$TYPES_followedYou = 300;
$TYPES_chatMessage = 500;
$TYPES_chatSticker = 501;
$TYPES_chatFile = 502;
$TYPES_chatLocation = 503;
$TYPES_chatFreeCall = 504;
$TYPES_chatVideoCall = 505;
$TYPES_chatInviteGroup = 506;
$TYPES_chatUserProfile = 507;
$TYPES_chatYoutube = 508;
$TYPES_chatSoundcloud = 509;
$TYPES_chatVoiceMessage = 510;
$TYPES_chatSystem = 511;
$TYPES_groupInvite = 520;
$TYPES_confInvite = 600;
$TYPES_confCreate = 601;
$TYPES_confJoin = 602;
$TYPES_newPostInFeed = 700;
//http://chat.vdomax.com/noti/index.php?
//title=HeyUsername%20is%20calling%20you
//&m=Swipe%20to%20receive%20a%20call
//&f=3&n=HeyUsername&t=6&type=505&conversation_id=345
$title = "VDOMAX";
$data_string = "";
if($type == 100)
$message = $from_name . " love your post";
elseif($type == 101)
$message = $from_name . " comment your post";
elseif($type == 102)
$message = $from_name . " share your post";
elseif($type == 103)
$message = $from_name . " report your post";
elseif($type == 300)
$message = $from_name . " start to follow you";
$message = rawurlencode($message);
$title = rawurlencode($title);
$from_name = rawurlencode($from_name);
$url = "http://chat.vdomax.com/noti/index.php";
$data_string .= "title=" . $title;
$data_string .= "&m=" . $message;
$data_string .= "&f=" . $from_id;
$data_string .= "&n=" . $from_name;
$data_string .= "&t=" . $to_id;
$data_string .= "&type=" . $type;
$data_string .= "&post_id=" . $post_id;
if($all)
$data_string .= "&all=1";
$url = $url . "?" . $data_string;
$return["url"] = $url;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
$result = curl_exec($ch);
/*
$xml = simplexml_load_string($result);
$json = json_encode($xml);
$array = json_decode($json,TRUE);
*/
$return["server"] = $result;
curl_close($ch);
return $return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment