본문 바로가기

PHP

File Upload Progress File Upload Progress Sample : http://www.johnboy.com/php-upload-progress-bar/ Important: Make sure to include apc.rfc1867 = on in your php.ini file after APC is installed. Your php.ini file should be located at /etc/php.ini. Intalling APC in Windows : http://docs.moodle.org/24/en/Installing_APC_in_Windows#Installation_on_Windows_Server Download : http://dev.freshsite.pl/php-accelerators/apc.html.. 더보기
extract 대체와 strip_tags를 이용한 전달변수 취득 foreach($_POST as $key => $value){ $$key = mysql_real_escape_string(strip_tags($value)); } foreach($_GET as $key => $value) { $$key = strip_tags($value)); } 더보기
Broadcasting in PHP After several hours of working with sockets in an attempt to do UDP broadcasting, I thought a little help was in order for anyone else looking to do something similar, since it uses a number of those "undocumented" functions. Here's how I did it: 더보기
HTTP 인증(Digest타입)이 걸린 URL을 fsockopen에서 여는 방법 function readHTTPDigestAuthenticatedFile($host,$port,$file,$username,$password) { if (!$fp=fsockopen($host, $port, $errno, $errstr, 15)) return false; //first do the non-authenticated header so that the server //sends back a 401 error containing its nonce and opaque $out = "GET /$file HTTP/1.1\r\n"; $out .= "Host: $host:$port\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); //read t.. 더보기
HTTP 인증(Basic타입)이 걸린 URL을 fsockopen에서 여는 방법 $objSock = fsockopen(호스트, 포트, $strErrorNo, $strErrStr, 5); if($objSock) { $strHeader = "GET http://url부분 HTTP/1.1\r\n"; $strHeader .= "Host:호스트:포트\r\n"; $strHeader .= "Authorization:Basic " . base64_encode("아이디:암호") . "\r\n"; $strHeader .= "\r\n"; fputs($objSock, $strHeader); $strResult = ""; while (!feof($objSock)) { $strResult .= fgets($objSock, 65535); } fclose($objSock); ... $objSock = fsock.. 더보기
[PHP] 변수에 여러줄 문자열 입력시 유용한 히어닥(Heredoc) $var = 더보기