Search Results for '전체 분류'


2051 posts related to '전체 분류'

  1. 2019/08/02 HDD 시리얼 넘버 변경 프로그램 - HardDiskSerialNumberChanger
  2. 2019/08/01 아이피 변경 맥 어드레스 변경 프로그램 - MAC - 물리적 주소
  3. 2019/07/30 시놀로지 폴더 마운트
  4. 2019/07/30 diskpart로 디스크를 간단하게 초기화 fdisk 윈도우
  5. 2019/07/23 파이썬 실행파일 만들기 icon 파일 포함하여 4
  6. 2019/07/21 구글 공식 ADB, Fastboot툴 다운로드 제공
  7. 2019/07/18 영카트 orderformupdate.php 특정 회원 주문시 입금 처리 하기
  8. 2019/07/10 SamsungNotes 삼성노트 윈도우10 설치 방법
  9. 2019/07/07 TextRank 기법
  10. 2019/07/01 유료 무료 테마 모음 사이트
  11. 2019/06/27 자바스크립트 멋진 소스 데모
  12. 2019/06/21 네이버 검색알고리즘 내용 01편
  13. 2019/05/10 위치정보를 가져오기 위해서는 getCurrentPosition() 함수를 사용하면 됩니다.
  14. 2019/05/09 네트워크 패킷 캡쳐 프로그램 SmartSniff - 한글판
  15. 2019/04/25 샤오미 센서 SmartThings 등록 방법 정리중
  16. 2019/04/21 2019년 윈도우10 인증 무설치 - KMSAuto_Lite_Portable_v1.5.6
  17. 2019/04/20 불교
  18. 2019/04/12 tr class 개수 처리
  19. 2019/04/12 특정 DB ENGINE 일괄변경
  20. 2019/04/12 숫자를 한글로 금액 단위 사용시
  21. 2019/04/12 CURL 사용법
  22. 2019/04/12 남은 일수 체크
  23. 2019/04/12 php 소스 그대로 노출되는 경우
  24. 2019/04/01 랜덤 배너 노출 스크립트
  25. 2019/04/01 값이 숫자인지 확인, Is_numeric() 함수
  26. 2019/04/01 페이지 접속시 자동으로 한번만 새로고침 하기
  27. 2019/04/01 동영상 사이트 주소 정규식
  28. 2019/04/01 무료 고해상도 이미지 다운받는 사이트 1
  29. 2019/03/25 홈페이지 쇼핑몰 최적화 방법
  30. 2019/03/22 php코드의 에러를 알려주는 사이트
from requests import get
import time

ip = get('https://youngsam.net/ipadd.php').text

while True:
print(ip)
time.sleep(5)
2019/09/16 11:08 2019/09/16 11:08
그누보드 각 게시판 글 수 구하기
<?php
$row = sql_fetch(" select bo_count_write from g5_board where bo_table='free' ");
echo $row[bo_count_write];
?>
2019/08/29 10:58 2019/08/29 10:58
mysql 특정 문자열 치환 ( 특정 문자열 변경 ) REPLACE


UPDATE 테이블명 SET 필드명 = REPLACE(필드명, '치환전 내용', '치환후 내용');


REPLACE
2019/08/21 16:56 2019/08/21 16:56
엑셀 날짜 지정날짜 랜덤 생성

=RANDBETWEEN(DATE(2019,4,1),DATE(2019,8,20))

형식으로 입력 하면 됨
2019/08/21 13:27 2019/08/21 13:27
사용자 삽입 이미지
2019/08/02 11:36 2019/08/02 11:36
사용자 삽입 이미지

한번에 맥어드레스  & IP 까지 변경해주는 프로그램 입니다. 

PC 랜카드  [물리적 주소] 를 변경해 주는 강력한 프로그램입니다. 

사용법 : 변경할 랜카드를 선택 하고 Random MAC Address 를 클릭 하면 랜덤으로 생성합니다. 이후

Change Now! 를 클릭하면 변경 됩니다. 사용후 다시 원상태로 돌리고 싶을 경우 Restore Original  클릭하면 복구 됩니다. 


링크 : https://technitium.com/tmac/index.html#download
2019/08/01 10:24 2019/08/01 10:24
sudo mount --bind /volume2/homes/openkr /volume1/web/openkr

위 형식으로 실행하면 reboot 이후 마운트가 헤지 된다. 이를 해결 할 방법이 있다. 

시놀로지 6X 이후 부터 변경

/usr/local/etc/rc.d  디렉토리에 S99mount.sh 파일을 만들어서 넣어 주면 자동 실행 된다.

즉 

/usr/local/etc/rc.d 폴더에 S99mount.sh 파일을 만들어서 내용에  sudo mount --bind /volume2/homes/openkr /volume1/web/openkr

한줄 추가 하면 끝난다  퍼미션 755 주고 재부팅 하면 끝

====================================================================================

6.2 버전 부터 [작업 스케줄러]  사용자 정의 스크립트 마운트 기능이 추가 되었습니다. 
 
mount --bind /volume2/homes/openkr /volume1/web/openkr

추가하면 끝

사용자 삽입 이미지
2019/07/30 21:37 2019/07/30 21:37
실행 
 
Ctrl + R > 실행 > cmd 치고 엔터 > diskpart를 cmd 에서 실행
 
정리
 
diskpart 엔터
 
# 디스크 확인
list disk
 
# 디스크 선택 : 아래의 5번은 예시이며 디스크 옆에 있는 숫자 확인
select disk 5
 
# 디스크 초기화
clean
2019/07/30 19:13 2019/07/30 19:13
EXE 파일 만들기
실행파일을 만들 000.py파일이 있는 폴더로 이동한 후에
pyinstaller.exe 000.py  실행합니다.
파일 하나로 만들려면 -F 옵션을 줍니다.
pyinstaller.exe -F 000.py
만약 console창을 숨기고 싶으면 다음과 같은 --noconsole 옵션을 추가하면 됩니다.
pyinstaller.exe -F --noconsole 000.py
실행파일 아이콘 삽입
pyinstaller.exe -F --noconsole --icon=icon\icon.ico ipadd.py

pyinstaller --onefile --icon=icon\icon.ico ipadd.py
icon 이라는 폴더의 icon.ico 파일입니다. 혹시 target.py 과 동일한 경로에 있을경우 --icon 를 -icon 수정하면 됩니다.
어떤 경우 C:\ 경로 가 아닌경우 액세스 오류가 나는 경우가 있습니다. 이럴경우 C 경로로 이동하여 실행 하면 정상 작동 합니다.
...
2019/07/23 12:59 2019/07/23 12:59
https://dl.google.com/android/repository/platform-tools-latest-windows.zip  윈도우



https://dl.google.com/android/repository/platform-tools-latest-darwin.zip 맥




https://dl.google.com/android/repository/platform-tools-latest-linux.zip 리눅스

2019/07/21 16:31 2019/07/21 16:31
$od_status = '주문';
$od_tno    = '';
if ($od_settle_case == "무통장")
{
    $od_receipt_point   = $i_temp_point;
    $od_receipt_price   = 0;
    $od_misu            = $i_price - $od_receipt_price;
if ($member['mb_id'] == "test") {
$od_misu = 0; // 미수잔액을 0으로
$od_receipt_price = $i_price; // 입금금액  $i_price  
}
if($od_misu == 0) {
$od_status      = '입금';
$od_receipt_time = G5_TIME_YMDHIS;
}
}

대략 272 라인 
shop/orderformupdate.php
2019/07/18 21:29 2019/07/18 21:29
삼성노트는 삼성PC 에서만 설치가 가능하다. 마이크로소프트 스토어에 다운 받으려 했으나 (이 앱은 이장치와 호환되지 않습니다.)
이런 메세지가 뜨면서 설치가 안된다. 삼성 노트북 팔어 먹으려는 수작이 아닌지  

방법이 있다.

https://androidfilehost.com/?fid=1322778262904019031 여기서 SamsungNotesMicrosoftStore.Appx

파일을 다운 받는다. 그리고 C : 폴더에 넣고

PowerShell 을  실행하고 C: 경로로 이동한다 실행한다 .. PowerShell

Add-AppxPackage SamsungNotesMicrosoftStore.Appx

위 명령을 실행한다. 잘 설치 된다.  이후 설치후 스토어 통해 최신버전으로 자동 업데이트 된다.

이제 스마트폰 노트와 PC 노트와 동기화 할수 있다. 이런 이유가 필요 했던건 . 삼성 스마트폰이 음성인식 텍스트 변환이 아주 잘된다. 
마케팅 등에 사용할 내용을 말로 정리하고 이를 PC 에서 수정해서 마케팅 등등에 사용하면 편하다.

2019/07/10 13:37 2019/07/10 13:37
https://github.com/theeluwin/textrankr
2019/07/07 04:06 2019/07/07 04:06
https://elements.envato.com/
2019/07/01 13:48 2019/07/01 13:48
https://www.developerdrive.com/11-experimental-javascript-projects-pushing-the-boundaries-of-scripting/

11 EXPERIMENTAL JAVASCRIPT PROJECTS PUSHING THE BOUNDARIES OF SCRIPTING

http://it79.egloos.com/v/1046109
2019/06/27 21:27 2019/06/27 21:27
네이버쇼핑 상품 검색 알고리즘
[답변]
네이버 쇼핑 검색 결과의 노출 순위를 결정하는 검색 알고리즘은 기본적으로 적합도, 인기도, 신뢰도의 3가지로 구성이 됩니다.
이를 바탕으로 제휴사가 제공하는 상품 정보와 네이버에서 수집하는 각종 쇼핑 데이터 및 검색 사용자 로그를 종합적으로 평가하여, 검색어 및 사용자 요구에 맞게 재구성하여 검색결과가 만들어집니다.
 
이 과정에서 검색결과 품질을 높이고, 사용자에게 다양한 검색결과를 제공하기 위한 별도의 검색 알고리즘이 반영될 수 있으며, 이를 보완하는 로직 및 대책이 수시로 반영될 수 있습니다.
또한 검색결과가 홍보 수단으로 활용되면서 각종 소프트웨어, 로봇 및 자동화된 도구를 이용해서 특정 상품을 노출시키려는 악의적인 시도 등이 늘고 있는데, 이러한 어뷰즈 행위는 검색 품질을 훼손하고 이용자의 불편을 초래하기 때문에 적극적으로 차단하고 있습니다.
네이버는 과학적인 방법을 동원해 어뷰즈를 정밀하게 필터링하여 서비스에 영향을 끼치지 않도록 하고 있으며, 기존 서비스 운영 경험을 토대로 검색 알고리즘 및 어뷰즈 필터링 로직을 지속적으로 개선하고 있습니다.
다만, 검색 알고리즘과 검색결과 어뷰즈 판정 기준이 알려질 경우 이를 우회한 새로운 어뷰즈 공격이 생기게 되고, 그에 따라 대다수 선의의 이용자들이 피해를 볼 수 있습니다.
따라서, 네이버는 상세한 검색 알고리즘 및 어뷰즈 필터링 로직과 해당 로직을 역으로 추정할 수 있는 어뷰즈 필터링 결과를 외부에 공개하지 않고 있습니다.
2.1. 적합도
이용자가 입력한 검색어가 상품명, 카테고리, 제조사/브랜드, 속성/태그 등 상품 정보의 어떤 필드와 연관도가 높은지, 검색어와 관련하여 어떤 카테고리의 선호도가 높은지 산출하여 적합도로 반영됩니다.
A.   필드 연관도
검색어가 “나이키”인 경우 “나이키”는 브랜드 유형으로 인식되며, 상품명에 “나이키”가 기입되어 있는 것보다 브랜드에 “나이키”로 매칭되어 있는 것이 우선적으로 노출됩니다.
B.   카테고리 선호도
“블라우스” 검색어의 경우는 여러 카테고리 상품이 검색되지만, [패션의류>여성의류>블라우스] 카테고리의 선호도가 매우 높습니다. 검색 알고리즘은 해당 카테고리의 상품을 먼저 보여줄 수 있게 추가 점수를 주게 됩니다.
2.2. 인기도
해당 상품이 가지는 클릭수, 판매실적, 구매평수, 찜수, 최신성 등의 고유한 요소를 카테고리 특성을 고려하여, 인기도로 반영됩니다.
인기도는 카테고리별로 다르게 구성되어 사용됩니다.
A.   클릭수
최근 7일 동안 쇼핑검색에서 발생된 상품 클릭수를 지수화
B.   판매실적
최근 2일/7일/30일 동안 쇼핑검색에서 발생한 판매수량/판매금액을 지수화
스마트스토어의 판매실적, 리뷰수는 네이버페이를 통해 자동 연동, 부정 거래가 있을 경우 페널티 부여
C.   구매평수
개별 상품의 리뷰수를 카테고리별 상대적으로 환산하여 지수화
D.   찜수
개별 상품의 찜수를 카테고리별 상대적으로 환산하여 지수화
E.   최신성
상품의 쇼핑DB 등록일을 기준으로 상대적 지수화, 신상품 한시적 노출 유도
2.3.  신뢰도
네이버쇼핑 페널티, 상품명 SEO 등의 요소를 통해 해당 상품이 이용자에게 신뢰를 줄 수 있는지는 산출하여, 신뢰도로 반영합니다.
A.   네이버쇼핑 페널티
구매평/판매실적 어뷰징, 상품정보 어뷰징 등에 대한 상품/몰단위 페널티 부여
B.   상품명 SEO 스코어
상품명 가이드라인을 벗어난 상품에 대한 페널티 부여

사용자 삽입 이미지

원본 : https://join.shopping.naver.com/faq/list.nhn?catgCd=H00015&dtlCatgCd=H00016
2019/06/21 12:29 2019/06/21 12:29
<script>
var x=document.getElementById("demo");
function getLocation()
  {
  if (navigator.geolocation)
    {
    navigator.geolocation.getCurrentPosition(showPosition);
    }
  else{x.innerHTML="Geolocation is not supported by this browser.";}
  }
function showPosition(position)
  {
  x.innerHTML="Latitude: " + position.coords.latitude +
  "<br />Longitude: " + position.coords.longitude;
  }
</script>
2019/05/10 11:30 2019/05/10 11:30
스마트 패킷 스니퍼 프로그램 입니다.

네트워크 패킷 캡쳐 프로그램 SmartSniff   스마트 스니퍼 프로그램을 이용하여 네트워크 패킷을 확인함
2019/05/09 10:59 2019/05/09 10:59
https://github.com/bspranger/Xiaomi
2019/04/25 21:54 2019/04/25 21:54
KMSAuto_Lite_Portable_v1.5.6-2019년

2019/04/21 01:44 2019/04/21 01:44

불교

경영 일기/김영삼 2019/04/20 11:01
       _oo0oo_
                                 088888880
                                 88" . "88
                                 (| -_- |)
                                  0\ = /0
                               ___/'---'\___
                             .' \\|     |// '.
                            / \\|||  :  |||// \
                           /_ ||||| -:- |||||- \
                          |   | \\\  -  /// |   |
                          | \_|  ''\---/''  |_/ |
                          \  .-\__  '-'  __/-.  /
                        ___'. .'  /--.--\  '. .'___
                     ."" '<  '.___\_<|>_/___.' >'  "".
                    | | : '-  \'.;'\ _ /';.'/ - ' : | |
                    \  \ '_.   \_ __\ /__ _/   .-' /  /
                ====='-.____'.___ \_____/___.-'____.-'=====
                                  '=---='
 
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

불교(佛敎, 영어: Buddhism, 네팔어: बौद्ध धर्म)는 기원전 6세기경 인도의 고타마 싯달타[1] 에 의해 시작된 종교이다. 불교는 그가 펼친 가르침이자 또한 진리를 깨달아 부처(붓다 · 깨우친 사람)가 될 것을 가르치는 종교이다.[2] 구체적으로는 고통에서 벗어나는 것 또는 고통이 없는 상태에 이르는 것이 가르침의 목적인데 이는 노자가 구체적으로 표현될 수 있는 건 도가 아니라고 한 가르침과 다르다. 상좌부 불교와 대승불교로 나눌 수 있다.[3] 오늘날까지 2,500년의 세월이 흐르는 동안 불교는 다양하고 복잡한 종교적 전통을 지니게 되었다. 그러나, 불교는 일반적으로 개조(開祖)로서의 부처, 가르침으로서의 법, 그리고 이를 따르는 공동체인 승의 삼보로 이루어져 있다고 설명할 수 있다.[4] 불교의 가르침을 반야 또는 보리와 혼동하는 주장이 있다. 해탈 또는 열반은 위 설명과 같이 벗어나는 것을 뜻하고 반야 등은 지혜를 뜻하므로 이들은 다르다. 깨달음에 도달하는 것은 열반에 도달하는 것과 동일하다.[5][6] 불교경전인 《열반경》에는 이러한 견해가 뚜렷이 나타나 있다. 우리나라의 불교도들은 접근의 편이성 때문에 니카야가 한문으로 번역된 중국 경전들, 중국의 선사들이 창작한 경전들, 이들을 우리말로 번역한 경전들을 주로 공부해 오고 있지만 이들은 고타마 싯달타의 가르침에 많은 부분들이 첨삭되어 있다. 이러한 문제 의식으로부터 최근 니카야 번역 작업이 활발하게 이뤄지고 있으며, 이미 영국에서는 약 한 세기 전부터 괄목할 만한 수준의 니카야 번역 작업이 이뤄지고 있다.
2019/04/20 11:01 2019/04/20 11:01
var numOfVisibleRows = $('tr.erd').filter(function() {
  return $(this).css('display') !== 'none';
}).length;
 
for(var ii=1;ii<=numOfVisibleRows;ii++) {
}
2019/04/12 12:05 2019/04/12 12:05
<?php
include_once('./_common.php');
$sql = "SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'dbbame' and engine = 'InnoDB'";
$rs = mysql_query($sql);
while($row = mysql_fetch_array($rs))
{
    $tbl = $row[0];
    $sql = "ALTER TABLE $tbl ENGINE=MyISAM";
    mysql_query($sql);
}
?>
 
 
InnoDB 인 것을 MyISAM으로
2019/04/12 12:04 2019/04/12 12:04
$pricem=$price_sum_tot; 
$trans_kor=array("","일","이","삼","사","오","육","칠","팔","구"); 
$price_unit=array("","십","백","천","만","십","백","천","억","십","백","천","조","십","백","천"); 
$valuecode=array("","만","억","조"); 
$value=strlen($pricem); 
$k=0; 
for($i=$value;$i>0;$i--){ 
    $vv=""; 
    $vc=substr($pricem,$k,1); 
    $vt=$trans_kor[$vc]; 
    $k++; 
    if($i%5 ==0){ 
        $vv=$valuecode[$i/5];
    } else { 
        if($vc) $vv=$price_unit[$i-1];
    } 
    
    $vr=$vr.$vt.$vv; 
}
2019/04/12 12:02 2019/04/12 12:02
cURL (Client URL Library Functions)
제작자 Daniel Stenberg 의 설명을 그대로 변역하면
curl is a comand line tool for transferring files with URL syntax
커맨드라인에서 URL 문법을 사용하여 파일을 전송 프로그램
내가 원하는 주소의 페이지에서 내가 임의의 값을 넣고 그 넣은 값으로 페이지에서 리턴되는 값을 받아오는 역할을 한다.
PHP에서 cURL을 사용하려는 사람들 대부분이 아마도 HTTPS 접속 때문일 것이다.
소켓 또는 그 외 여러가지 접속방법이 있는데 굳이 cURL을 사용하는 건 속도면에서도 빠르고 HTTPS도 쉽게 접속할 수 있기 때문이다.
cURL 모듈을 서버에 설치해야 합니다.(리눅스 - curl.so, 윈도우 - php_curl.dll 확장모듈 필요)
 
cURL로 가능한 일
HTTPS certificates
HTTP POST
HTTP PUT
FTP upload
HTTP Form
cookie
authentication
 
cURL, Client URL Library Functions
curl_init : 세션 초기화, 핸들값 리턴
curl_setopt : 옵션 세팅
curl_exec : curl을 실행
curl_errno : 에러번호를 가져온다.
curl_error : 에러 메시지를 가져온다.
curl_getinfo : 상태 정보를 리턴한다.
curl_close : curl 세션을 닫는다
 
[예제1 : POST방식으로 데이터 전송(simple)]
<?
$post_data = array(
"name" => "홍길동",
"birthday" => "1980-08-20"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, http://www.example.com);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_exec($ch);
?>
 
[예제2: POST방식으로 데이터 전송(function)]
<?
function fetch_page($url,$param,$cookies,$referer_url){
if(strlen(trim($referer_url)) == 0) $referer_url= $url;
$curlsession = curl_init ();
curl_setopt ($curlsession, CURLOPT_URL, \"$url\");
curl_setopt ($curlsession, CURLOPT_POST, 1);
curl_setopt ($curlsession, CURLOPT_POSTFIELDS, \"$param\");
curl_setopt ($curlsession, CURLOPT_POSTFIELDSIZE, 0);
curl_setopt ($curlsession, CURLOPT_TIMEOUT, 60);
if($cookies && $cookies!=\"\"){
curl_setopt ($curlsession, CURLOPT_COOKIE, \"$cookies\");
}
curl_setopt ($curlsession, CURLOPT_HEADER, 1); //헤더값을 가져오기위해 사용합니다. 쿠키를 가져오려고요.
curl_setopt ($curlsession, CURLOPT_USERAGENT, \"Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)\");
curl_setopt ($curlsession, CURLOPT_REFERER, \"$referer_url\");
ob_start();
$res = curl_exec ($curlsession);
$buffer = ob_get_contents();
ob_end_clean();
if (!$buffer) {
$returnVal = \"Curl Fetch Error : \".curl_error($curlsession);
}else{
$returnVal = $buffer;
}
curl_close($curlsession);
return $returnVal;
}
?>
 
[예제3 : 파일 전송]
<?
$post_data['data[0]'] = "@image/img_01.jpg";
$post_data['data[0]'] = "@image/img_02.jpg";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, http://www.example.com/upload.php);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$postResult = curl_exec($ch);
?>
[예제4 : https 접속]
<?
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL,"https://www.test.com"); //접속할 URL 주소
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // 인증서 체크같은데 true 시 안되는 경우가 많다.
// default 값이 true 이기때문에 이부분을 조심 (https 접속시에 필요)
curl_setopt ($ch, CURLOPT_SSLVERSION,3); // SSL 버젼 (https 접속시에 필요)
curl_setopt ($ch, CURLOPT_HEADER, 0); // 헤더 출력 여부
curl_setopt ($ch, CURLOPT_POST, 1); // Post Get 접속 여부
curl_setopt ($ch, CURLOPT_POSTFIELDS, "var1=str1&var2=str2"); // Post 값 Get 방식처럼적는다.
curl_setopt ($ch, CURLOPT_TIMEOUT, 30); // TimeOut 값
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); // 결과값을 받을것인지
$result = curl_exec ($ch);
curl_close ($ch);
echo $result;
?>
 
[예제5 : curl을 이용한 Gmail 로그인]
$src = "https://".$gmailId.":".$gmailPw."@mail.google.com/mail/feed/atom";
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST,true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_USERAGENT, 'My Agent Name');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
$res = curl_exec($ch);
curl_close($ch);
/** 결과는 Atom xml 형식이다. DOM 또는 xml 파싱 function을 이용해서 파싱하면 됩니다. **/
echo $res;
?>
 
[예제6 : cURL을 이용한 웹페이지 가져오기]
<?php
function get_content($url) {
$agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)';
$curlsession = curl_init ();
curl_setopt ($curlsession, CURLOPT_URL, $url);
curl_setopt ($curlsession, CURLOPT_HEADER, 0);
curl_setopt ($curlsession, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($curlsession, CURLOPT_POST, 0);
curl_setopt ($curlsession, CURLOPT_USERAGENT, $agent);
curl_setopt ($curlsession, CURLOPT_REFERER, "");
curl_setopt ($curlsession, CURLOPT_TIMEOUT, 3);
$buffer = curl_exec ($curlsession);
$cinfo = curl_getinfo($curlsession);
curl_close($curlsession);
if ($cinfo['http_code'] != 200)
{
return "";
}
return $buffer;
}
?>
 
curl_close
기능 : cURL 세션을 닫는다.
구문 : curl_close(resource ch)
cURL 세션을 닫고, 리소스를 비워준다. 또한 cURL 핸들은 삭제된다.
 
기능 : 마지막 에러 번호를 리턴해 준다.
구문 : curl_errno(resource ch)
만일 연산 후 어떠한 에러도 발행하지 않았다면 0(zero)을 리턴한다.
 
Error Code
There exists a bunch of different error codes and their corresponding error messages that may appear during bad conditions. At the time of this writing, the exit codes are:
1 - Unsupported protocol. This build of curl has no support for this protocol.
2 - Failed to initialize.
3 - URL malformat. The syntax was not correct.
잘못된 형식의 도메인
5 - Couldn't resolve proxy. The given proxy host could not be resolved.
6 - Couldn't resolve host. The given remote host was not resolved.
해당 도메인을 못찾는다는 뜻
네임서버가 제대로 등록되어 있는지 확인하고 도메인도 정확한지 확인할 것.
7 - Failed to connect to host.
8 - FTP weird server reply. The server sent data curl couldn't parse.
9 - FTP access denied. The server denied login or denied access to the particular resource or directory you wanted to reach. Most often you tried to change to a directory that doesn't exist on the server.
11 - FTP weird PASS reply. Curl couldn't parse the reply sent to the PASS request.
13 - FTP weird PASV reply, Curl couldn't parse the reply sent to the PASV request.
14 - FTP weird 227 format. Curl couldn't parse the 227-line the server sent.
15 - FTP can't get host. Couldn't resolve the host IP we got in the 227-line.
17 - FTP couldn't set binary. Couldn't change transfer method to binary.
18 - Partial file. Only a part of the file was transferred.
19 - FTP couldn't download/access the given file, the RETR (or similar) command failed.
21 - FTP quote error. A quote command returned error from the server.
22 - HTTP page not retrieved. The requested url was not found or returned another error with the HTTP error code being 400 or above. This return code only appears if -f/--fail is used.
23 - Write error. Curl couldn't write data to a local filesystem or similar.
25 - FTP couldn't STOR file. The server denied the STOR operation, used for FTP uploading.
26 - Read error. Various reading problems.
27 - Out of memory. A memory allocation request failed.
28 - Operation timeout. The specified time-out period was reached according to the conditions.
30 - FTP PORT failed. The PORT command failed. Not all FTP servers support the PORT command, try doing a transfer using PASV instead!
31 - FTP couldn't use REST. The REST command failed. This command is used for resumed FTP transfers.
33 - HTTP range error. The range "command" didn't work.
34 - HTTP post error. Internal post-request generation error.
35 - SSL connect error. The SSL handshaking failed.
36 - FTP bad download resume. Couldn't continue an earlier aborted download.
37 - FILE couldn't read file. Failed to open the file. Permissions?
38 - LDAP cannot bind. LDAP bind operation failed.
39 - LDAP search failed.
41 - Function not found. A required LDAP function was not found.
42 - Aborted by callback. An application told curl to abort the operation.
43 - Internal error. A function was called with a bad parameter.
45 - Interface error. A specified outgoing interface could not be used.
47 - Too many redirects. When following redirects, curl hit the maximum amount.
48 - Unknown TELNET option specified.
49 - Malformed telnet option.
51 - The peer's SSL certificate or SSH MD5 fingerprint was not ok
에러 메시지) SSL: certificate subject name 'www.test.co.kr' does not match target host name 'test.co.kr'
해결1) 인증서 발급받은 주소로 호출하거나
해결2) 설정으로 제어
$soapClient->setOpt('curl', CURLOPT_SSL_VERIFYHOST, 0);
52 - The server didn't reply anything, which here is considered an error.
53 - SSL crypto engine not found
54 - Cannot set SSL crypto engine as default
55 - Failed sending network data
56 - Failure in receiving network data
58 - Problem with the local certificate
59 - Couldn't use specified SSL cipher
60 - Peer certificate cannot be authenticated with known CA certificates
인증서 신뢰 검증에 실패한 경우다. (통합인증서, 번들과 관련 있는 듯)
에러 메시지) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
해결) 신뢰 검증을 하지 않도록 설정.
상호 서버가 신뢰된다면 굳이 신뢰성을 검증하지 않아도 된다.
$soapClient->setOpt('curl', CURLOPT_SSL_VERIFYPEER, 0);
61 - Unrecognized transfer encoding
62 - Invalid LDAP URL
63 - Maximum file size exceeded
64 - Requested FTP SSL level failed
65 - Sending the data requires a rewind that failed
66 - Failed to initialise SSL Engine
67 - User, password or similar was not accepted and curl failed to login
68 - File not found on TFTP server
69 - Permission problem on TFTP server
70 - Out of disk space on TFTP server
71 - Illegal TFTP operation
72 - Unknown TFTP transfer ID
73 - File already exists (TFTP)
74 - No such user (TFTP)
75 - Character conversion failed
76 - Character conversion functions required
77 - Problem with reading the SSL CA cert (path? access rights?)
78 - The resource referenced in the URL does not exist
79 - An unspecified error occurred during the SSH session
80 - Failed to shut down the SSL connection
XX - There will appear more error codes here in future releases. The existing ones are meant to never change
 
curl_error
기능 : 그 현재의 세션에 대한 마지막 에러 메시지를 되돌려 준다.
구문 : curl_error(resource ch)
만일 cURL 연산 후 에러를 발생하면 에러메시지를 되돌려 주며, 에러가 발생하지 않으면 빈문자열을 되돌려 준다.
 
 
curl_init
기능 : 세션을 초기화하고 curl_setopt(), curl_exec() 그리고 curl_close 함수들과 함께 사용하기 위해 CURL 핸들값을 리턴해준다.
구문 : resource curl_init([string $url])
옵션 Url 매개변수가 포함되어 있다면 CURLOPT_URL 옵션은 매개변수의 값을 셋팅할 것이다.
curl_setopt()를 이용하여 셋팅할 수 있다.
리턴 : 핸들값 or False
예제 : 새로운 curl세션을 초기화하고 웹페이지를 페칭한다.
< ?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
?>
 
curl_exec
기능 : 세션을 싱행한다.
구문 : curl_exec(resource ch)
이 함수는 cURL 세션을 초기화하고 세션의 옵션들을 셋팅한 후에 불려져야만 한다.
본 함수의 목적은 단순히 미리 정의된 cURL 세션을 실행하기 위한 것이기 때문이다.
 
 
curl_getinfo
기능 : 특정 전송에 대한 정보를 받는다.
구문 : crul_getinfo(resource ch [, int opt])
 
 
 
curl_setopt
CURLOPT_FOLLOWLOCATION
TRUE to follow any "Location: " header that the server sends as part of the HTTP header (note this is recursive, PHP will follow as many "Location: " headers that it is sent, unless CURLOPT_MAXREDIRS is set).
FOLLOWLOCATION 옵션 설정. 위치 헤더가 존재하면 따라간다.
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, tru
 
CURLOPT_HEADER
TRUE to include the header in the output.
헤더 정보를 받기 원한다면 이 옵션을 추가한다.
VALUE : 1 OR true
curl_setopt($ch, CURLOPT_HEADER, false);
 
CURLOPT_NOBODY
TRUE to exclude the body from the output.
본문의 정보를 받기 원하지 않는다면 이 옵션을 추가한다.
CURLOPT_POST
TRUE to do a regular HTTP POST. This POST is the normal application/x-www-form-urlencoded kind, most commonly used by HTML forms.
전송 메소드를 설정한다.
VALUE : 1-POST, 0-GET
curl_setopt($ch, CURLOPT_POST,1);
CURLOPT_RETURNTRANSFER
TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it out directly.
REQUEST 에 대한 결과값을 받을 건지 체크
(WRITERUNCTION 콜백을 사용하는 대신, curl_exec 함수을 위한 반환 값으로 원격지 내용을 받는다.)
#Resource ID 형태로 넘어옴 :: 내장 함수 curl_errno 로 체크
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
CURLOPT_SSL_VERIFYPEER
FALSE to stop cURL from verifying the peer's certificate. Alternate certificates to verify against can be specified with the CURLOPT_CAINFO option or a certificate directory can be specified with the CURLOPT_CAPATH option. CURLOPT_SSL_VERIFYHOST may also need to be TRUE or FALSE if CURLOPT_SSL_VERIFYPEER is disabled (it defaults to 2).
인증서 체크같은데 true 시 안되는 경우가 많다.
default 값이 true 이기때문에 이 부분을 조심 (https 접속시에 필요)
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
CURLOPT_PORT
An alternative port number to connect to.
CURLOPT_SSLVERSION
The SSL version (2 or 3) to use. By default PHP will try to determine this itself, although in some cases this must be set manually.
SSL 버젼 (https 접속시에 필요)
curl_setopt ($ch, CURLOPT_SSLVERSION,3);
 
CURLOPT_TIMEOUT
The maximum number of seconds to allow cURL functions to execute.
REQUEST 에 대한 결과값을 받는 시간타임 설정한다.
curl_setopt($ch, CURLOPT_TIMEOUT,100);
CURLOPT_POSTFIELDS
The full data to post in a HTTP "POST" operation. To post a file, prepend a filename with @ and use the full path.
POST 메소드라면 파라미터 값들을 이 옵션에 정의하면 된다.
curl_setopt($cu, CURLOPT_POSTFIELDS,$vars); // 보낼 데이타 형식은 GET 방식으로 설정
ex) $vars = "arg=$arg1&arg2=$arg2&arg3=$arg3";
CURLOPT_REFERER
The contents of the "Referer: " header to be used in a HTTP request.
리퍼러 정보를 설정
CURLOPT_URL
The URL to fetch. This can also be set when initializing a session with curl_init().
접속할 url정보를 설정
curl_init()에서 url를 설정하면 별도 설정이 필요없다.
curl_setopt($ch, CURLOPT_URL, 'http://www.exsample.com');
CURLOPT_USERAGENT
The contents of the "User-Agent: " header to be used in a HTTP request.
에이전트 정보를 설정
curl_setopt($ch, CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
2019/04/12 12:01 2019/04/12 12:01
// 선택 옵션에서 숫자만
$use_io_days =  preg_replace("/[^0-9]*/s", "", $row[io_id]);
 
​// 해당일만큼 증가 후 종료일로 지정 - 현재일과 차이
$use_date =  (strtotime(date('Y-m-d', strtotime("+".$use_io_days."day", strtotime($row['pay_datetime'])))) - strtotime(G5_TIME_YMD)) / 86400;  //  G5_TIME_YMD​
2019/04/12 12:00 2019/04/12 12:00
# vi /etc/php.ini
1. short_open_tag = On 
<? 
echo "사용가능";
 ?> 
 
2. short_open_tag = Off
<?php
echo "사용가능";
 ?> 
 
2번 흐름 - 보안상 이점
2019/04/12 11:59 2019/04/12 11:59
<script type="text/javascript">
  var result = Math.floor(Math.random() * 8) + 1;
if(result == '1'){
document.writeln("<a href='' target='_blank'><img src='' height='600' width='160' border='0'></a>");
}
else if(result == '2'){
document.writeln("<a href='' target='_blank'><img src='' height='600' width='160' border='0'></a>");
}
else if(result == '3'){
document.writeln("<a href='' target='_blank'><img src='' height='600' width='160' border='0'></a>");
}
else if(result == '4'){
document.writeln("<a href='' target='_blank'><img src='' height='600' width='160' border='0'></a>");
}
else if(result == '5'){
document.writeln("<a href='' target='_blank'><img src='' height='600' width='160' border='0'></a>");
}
else if(result == '6'){
document.writeln("<a href='' target='_blank'><img src='' height='600' width='160' border='0'></a>");
}
else  {
document.writeln("<a href='' target='_blank'><img src='' height='600' width='160' border='0'></a>");
}
</script>
2019/04/01 11:34 2019/04/01 11:34
변수 $sam를 is_numeric() 함수를 이용해 숫자형 데이터인 경우 true를 아닌 경우에는 false를 반환

<?php
  $sam="12345";
  // 숫자 타입의 데이터를 선언
  if (is_number($sam)) {
    echo '숫자 입니다.';
  }
  else {
    echo '문자 입니다.';
  }
?>
결과는 (숫자 입니다)
2019/04/01 11:33 2019/04/01 11:33
<?php
if (!$_COOKIE['reload']) {
 setcookie("reload",time()+60*60*24); // 하루동안만..
 echo "<meta http-equiv='Refresh' CONTENT='0'; URL=".$_SERVER['PHP_SELF']." />";
 }
?>
페이지 접속시 자동으로 한번만 새로고침 리로드 하기
2019/04/01 11:29 2019/04/01 11:29