PHP 함수 curl_get_contents()

Jmnote bot (토론 | 기여)님의 2020년 11월 2일 (월) 02:56 판 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요[ | ]

PHP 함수 curl_get_contents()
PHP
Copy
function curl_get_contents($url) {
	$ch = curl_init($url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
	$data = curl_exec($ch);
	echo curl_error($ch);
	curl_close($ch);
	return $data;
}
echo curl_get_contents('https://raw.githubusercontent.com/jmnote/Miscellaneous/master/greet-utf8.txt');
# Hello 안녕
# World 세상

2 같이 보기[ | ]