2011년 11월 15일 화요일

구글 캘린더를 통해 무료 sms 발송

<?
/*구글 캘린더를 통해 sms 발송*/

require_once 'Google/Calendar.php';

$ID='xxxxx@gmail.com';
$PW='xxx';

$startTime=date("Y-m-d\TH:i:s+09:00", time());
$endTime=date("Y-m-d\TH:i:s+09:00", time()+180);

$title='타이틀';
$content='설명';
$where='장소';

$service = new Google_Calendar;
if (!$service->requestClientLogin($ID,$PW)) {
exit("ClientLogin has failed\n".$service->getResponseBody());
}

$entry = <<<GDATA
<entry
xmlns="http://www.w3.org/2005/Atom"
xmlns:gd="http://schemas.google.com/g/2005">
<category
scheme="http://schemas.google.com/g/2005#kind"
term="http://schemas.google.com/g/2005#event">
</category>
<title type="text">$title</title>
<content type="text">$content</content>
<gd:where valueString="$where">
</gd:where>
<gd:when
startTime="$startTime"
endTime="$endTime">
<gd:reminder minutes='0' method='sms' />
</gd:when>
</entry>
GDATA;

if (!$service->insert($entry, "http://www.google.com/calendar/feeds/xxxxxxxxxxxxx@group.calendar.google.com/private/full")) {
exit("Inserting an entry has failed\n".$service->getResponseBody());
}

?>

이 파일이 필요함.
추가기능 밖에 없음.

xxxxxxxxxxxxx@group.calendar.google.com << 이부분은 캘린더ID
기본 캘린더를 쓰려면 default

참고로 캘린더ID는 여깄음.

사용자 삽입 이미지

출처:http://codepasta.net/50
http://www.rcdtokyo.com/etc/gdataapis/

sendmail 유용한 명령어

큐 확인.
mailq


강제 큐 송출
sendmail -oQ/var/spool/mqueue -oT1d -q -v


---------------------------------------------------------------------------
멀티큐는 기본.
mkdir /var/spool/mqueue/q{1,2,3,4,5,6,7,8,9}


/etc/mail/sendmail.cf에서 아래처럼 변경.
# queue directory
#O QueueDirectory=/var/spool/mqueue
O QueueDirectory=/var/spool/mqueue/q*

명령어 사용.
perl -pi -e 's/O\ QueueDirectory=\/var\/spool\/mqueue/O\ QueueDirectory=\/var\/spool\/mqueue\/q\*/g' /etc/mail/sendmail.cf

재시작.
service sendmail restart

알테온 3804 [로드밸런싱 설정시 느려지는 접속이 잘 안되는 현상.]

알테온 3804를 이용한 로드밸런싱을 구축하였다.

예전 config설정을 사용하는 거라 크게 문제는 없을 거라 생각하였다.

설정을 다 마치고 테스트를 하는 데, 웹페이지가 뜨는 곳이 있고, 안뜨는 곳이 있는 현상이 발생하였다.

원인은 새로 추가하는 서버들에대해서는 L4스위치 바로 밑에 L2스위치를 놓고 연결하여 문제가 되지 않았지만, 기존에 사용하였던 장비들은 L4밑에 있지 않았는데, health check에서는 살아있는 걸로

나와 그냥 셋팅 하였던게 문제였다.

해당 서버들을 disable 시켜 놓고 테스트 하니, 정상적으로 접속 되는 것 확인 했다.

해당 서버들의 물리적인 랜선을 L4 밑 L2 스위치에 넣고 enable 하니 정상적으로 동작 했다.

워드, 엑셀, 파워포인트 , xml 형식으로 출력 , php 헤더설정

header("Content-Type: text/plain;charset=euc-kr");

<meta http-equiv=Content-Type content="text/html; charset=ks_c_5601-1987">


header( "Content-Disposition: attachment; filename=search_result.xls" );


//한글 출력


 


엑셀 <? header("Content-Type: application/vnd.ms-excel"); ?>

워드 <? header("Content-Type: application/msword"); ?>

파워포인트 <? header("Content-Type: application/vnd.ms-powerpoint"); ?>

ASP에서 엑셀
 <% Response.Buffer = TRUE Response.ContentType = "application/vnd.ms-excel" %>





해더 부분의 ContentType을 지정해서 해당되는 형식으로 출력하도록 만드는 것






header("Content-Type: application/vnd.ms-excel");  
header("Content-Disposition: attachment; filename=직원전화.xls");
header("Content-Description: PHP4 Generated Data" );  






xml형식을 출력



header("Content-type: application/xml");
header("Content-Disposition: attachment; filename=파일명);
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
header("Pragma: public");









출처:http://www.mins01.com/20090118/board/board.php?type=read&b_id=tech&sh=title&cat=&page=1&b_idx=29