반응형
function http_get($host, $path, $data, $cookie) {
$http_response = "";
$fp = fsockopen($host, 80);
fputs($fp, "GET ".$path." HTTP/1.1\r\n");
fputs($fp, "Host: ".$host."\r\n");
fputs($fp, "User-Agent: ".$_SERVER["HTTP_USER_AGENT"]."\r\n");
fputs($fp, "Referer: http://".$host.$path."\r\n");
fputs($fp, "Cookie: ".$cookie."\r\n");
fputs($fp, "Content-Type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-Length: ".strlen($data)."\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $data);
while(!feof($fp)) {
$http_response .= fgets($fp, 128);
}
fclose($fp);
return $http_response;
}
'Coding > Etc' 카테고리의 다른 글
php json 처리 (0) | 2016.02.27 |
---|---|
PHP curl (0) | 2016.02.26 |
롤 API Key 발급받기 (0) | 2016.02.26 |
C# 무한루프에 딜레이 주기 (0) | 2016.02.24 |
Cannot send session cookie - headers already sent by 세션오류 (0) | 2016.01.24 |