일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- replace
- XMLHTTP
- 시놀로지
- FileSystemObject
- jQuery
- Getrows
- javascript
- 따라다니는 배너
- SQL Injection
- disabled
- 무선랜카드
- readonly
- submit
- include
- PHP GCM
- euc-kr
- jquery 레이어
- AC1300
- Injection
- form
- RTL88x2BU
- 커널
- lsusb
- ASP
- DS718+
- 크로스 컴파일
- synology
- ajax
- utf-8
- println
- Today
- Total
아는 것이 좋은 것이다.
[PHP] GCM 푸시 예제 소스(2) 본문
<?
$reg_id = $_REQUEST['regid'];
$headers = array(
'Content-Type:application/json',
'Authorization:key=API키값'
);
//$temp_id = $_POST['id'];
$temp_msg = "메시지 테스트";
//$myServer = "localhost,포트(기본적으로 mssql은 1433을 씀)";
//$myUser = "아이디";
//$myPass = "비밀번호";
//$myDB = "DB명";
//$db = mssql_connect($myServer, $myUser, $myPass) or die ("서버 연결 실패");
//mssql_select_db($myDB,$db) or die ("DB 연결 실패");
//$result=mssql_query("select reg_id from personinfo where id = '$temp_id'");
//$reg_id = mssql_result($result, 0, "reg_id");
//echo "Reg_id = $reg_id 입니다.";
$arr = array();
$arr['data'] = array();
$arr['data']['msg'] = "메시지";
$arr['registration_ids'] = array();
$arr['registration_ids'][0] = "$reg_id";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://android.googleapis.com/gcm/send');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($arr));
$response = curl_exec($ch);
echo $response;
curl_close($ch);
?>
'PHP' 카테고리의 다른 글
[PHP] 코드이그나이터 index.php 삭제하기 (0) | 2015.02.13 |
---|---|
[PHP] 코드이그나이터 마지막으로 사용한 쿼리 출력 (0) | 2015.02.10 |
[PHP] 배열출력하기, 배열 확인하기 (0) | 2014.07.18 |
[PHP] 푸시 메시지 보내기 (GCM) (0) | 2014.07.15 |
[PHP] 문자열 인코딩 변환 (0) | 2014.06.30 |