Last active
January 5, 2017 14:15
-
-
Save white5168/cc1aeb9d652ac11c7b006cb804c83f7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$initData['message'] = '傳網頁圖檔測試 家扶娃娃撲滿 ~!@#$%^*()1234567890ABCabc'; | |
$initData['imageThumbnail'] = 'http://www.ccf.org.tw/new/endpoverty/images/product/product-pic1.jpg'; | |
$initData['imageFullsize'] = 'http://www.ccf.org.tw/new/endpoverty/images/product/product-pic1.jpg'; | |
$initData['stickerPackageId'] = '1'; | |
$initData['stickerId'] = '106'; | |
$token = '你的Token'; | |
echo '<pre>'; | |
print_r(sendLineNotify($initData, $token)); | |
echo '</pre>'; | |
function sendLineNotify($initData, $token,$url = 'https://notify-api.line.me/api/notify') { | |
$ch = curl_init(); | |
$header[] = 'Authorization: Bearer'; | |
$header[] = $token; | |
curl_setopt_array($ch, array( | |
CURLOPT_URL => $url, | |
CURLOPT_POST => TRUE, | |
CURLOPT_RETURNTRANSFER => TRUE, | |
CURLOPT_SSL_VERIFYHOST => 0, | |
CURLOPT_SSL_VERIFYPEER => 0, | |
CURLOPT_HTTPHEADER => array(implode(' ',$header)), | |
CURLOPT_POSTFIELDS => http_build_query($initData), | |
)); | |
$result = curl_exec($ch); | |
curl_close($ch); | |
$aResult = json_decode ($result, TRUE); | |
return $aResult; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment