게시글 등록 주소문제에요[스윙투앱 푸시연동]
본문
스윙투앱을 이용하여 게시글 등록시 푸시되게하는데요
message_link_url = https://ciel.kr/bbs/board.php?bo_table=download&wr_id=25621
이런식으로 입력해두면 푸시글 클릭시 본문으,로 잘갑니다
그런데
'message_link_url' = "".G5_BBS_URL."/board.php?bo_table={$bo_table}&wr_id={$wr_id}";
이런식으로 조금씩 변경하며 해봐도 잘 가지를 못하는데 도움이 필요해요^^
아래는 스윙투앱 푸시 소스입니다
// 변수 선언 $appId = '5e30c422-ed8d-4956-8e32-60ffcb9f6f45'; // 실제 app_id
$apiKey = '903a80db-e000-11ed-9d4c-0ab43c319424'; // 실제 app_api_key
$sendTargetList = '-1'; // 예: 'test' 또는 '-1' (전체 대상) //
이미지 및 링크 URL
$messageImageUrl = 'https://www.ciel.kr/abc.png';
$messageLinkUrl = 'https://ciel.kr'; //
curl 초기화
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://www.swing2app.com/swapi/push_api_send_message', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array( 'app_id' => $appId, 'app_api_key' => $apiKey, 'send_target_list' => $sendTargetList, 'send_type' => 'push', 'message_title' => $tmplMsg, // ← 메시지 제목에 $tmplMsg 사용 'message_content' => $tmplMsg, // ← 메시지 본문에도 $tmplMsg 사용
'message_image_url' => $messageImageUrl,
'message_link_url' => $messageLinkUrl ), ));
$response = curl_exec($curl);
curl_close($curl);
답변 2
스윙투앱 푸시소스에
include_once("./common.php");
그누보드 common 파일을 인클루드 하셔야 그누보드 경로 함수가 적용될듯 싶습니다.
<?php
// 변수 선언
$appId = '5e30c422-ed8d-4956-8e32-60ffcb9f6f45';
$apiKey = '903a80db-e000-11ed-9d4c-0ab43c319424';
$sendTargetList = '-1';
// 이미지 및 링크 URL
$messageImageUrl = 'https://www.ciel.kr/abc.png';
$messageLinkUrl = G5_BBS_URL."/board.php?bo_table={$bo_table}&wr_id={$wr_id}";
// curl 초기화
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://www.swing2app.com/swapi/push_api_send_message',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array(
'app_id' => $appId,
'app_api_key' => $apiKey,
'send_target_list' => $sendTargetList,
'send_type' => 'push',
'message_title' => $tmplMsg,
'message_content' => $tmplMsg,
'message_image_url' => $messageImageUrl,
'message_link_url' => $messageLinkUrl // ← 여기에 동적 URL 적용
),
));
$response = curl_exec($curl);
curl_close($curl);
?>