php snoopy 라이브러리로 크롤링기능을 개발하여 서버에 업로드 하였다.
개발 서버에서는 정상 작동하던 프로그램이 서버이전시 다음과 같은 error 메세지를 표시하며 작동하지 않았다.
stream_socket_client() php_network_getaddresses getaddrinfo failed name or service not known
원인
1)서버 접근 권한없음
2)서버에서 요청이 나갈 권한이 없음.
해결 방법
1) 본인의 포트와 호스트를 확인하여 서버 접속 권한을 얻으면된다.
2) 프록시 우회기능을 사용한다.
snoopy의 경우 38~39line
var $proxy_host = ""; // proxy host to use
var $proxy_port = ""; // proxy port to use
이곳에 우회 ip와 포트를 입력하면
아래 소스 코드의 연결부분에서 프록시를 반영하여 우회 접속이 된다.
function _connect(&$fp)
{
if (!empty($this->proxy_host) && !empty($this->proxy_port)) {
$this->_isproxy = true;
$host = $this->proxy_host;
$port = $this->proxy_port;
if ($this->scheme == 'https') {
trigger_error("HTTPS connections over proxy are currently not supported", E_USER_ERROR);
exit;
}
} else {
$host = $this->host;
$port = $this->port;
}
....
HTTPS connections over proxy are currently not supported error 발생시 해결방법
'개발 > php' 카테고리의 다른 글
php curl 새창 읽기 get 방식, post 방식 데이터 넘기기 예제 (0) | 2021.01.19 |
---|---|
php 카카오 로그인 예제 (0) | 2021.01.19 |
php array_pop()이란 예제 (0) | 2021.01.19 |
"continue" targeting switch is equivalent to "break". error fix (0) | 2021.01.19 |
HTTPS connections over proxy are currently not supported (0) | 2021.01.12 |
댓글