The code I have so far is like this
<?
$url="http://djcp.co.uk:8000/admin.cgi?mode=kicksrc";
// The usual - init a curl session and set the url
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $base_url);
// Set your login and password for authentication
curl_setopt($ch, CURLOPT_USERPWD, 'admin:xxxxxxx');
// You can use CURLAUTH_BASIC, CURLAUTH_DIGEST, CURLAUTH_GSSNEGOTIATE,
// CURLAUTH_NTLM, CURLAUTH_ANY, and CURLAUTH_ANYSAFE
//
// You can use the bitwise | (or) operator to combine more than one method.
// If you do this, CURL will poll the server to see what methods it supports and pick the best one.
//
// CURLAUTH_ANY is an alias for CURLAUTH_BASIC | CURLAUTH_DIGEST |
// CURLAUTH_GSSNEGOTIATE | CURLAUTH_NTLM
//
// CURLAUTH_ANYSAFE is an alias for CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE |
// CURLAUTH_NTLM
//
// Personally I prefer CURLAUTH_ANY as it covers all bases
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
// This is occassionally required to stop CURL from verifying the peer's certificate.
// CURLOPT_SSL_VERIFYHOST may also need to be TRUE or FALSE if
// CURLOPT_SSL_VERIFYPEER is disabled (it defaults to 2 - check the existence of a
// common name and also verify that it matches the hostname provided)
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// Optional: Return the result instead of printing it
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// The usual - get the data and close the session
$data = curl_exec($ch);
curl_close($ch);
?>
'유용한정보' 카테고리의 다른 글
SHOUTcast Stream Ripper (0) | 2016.02.15 |
---|---|
SHOUTcast/Installation (0) | 2016.02.15 |
PhP script to parse Shoutcast metadata? (0) | 2016.02.09 |
SHOUTCast AutoDJ (0) | 2016.02.09 |
검색엔진 최적화. 꼭 알아야 할 HTTP 상태 코드 (0) | 2016.02.07 |
각종 확장자 파일모음 (0) | 2016.02.01 |
윈엠프 음악방송 유틸 모음 세팅을 한번에 (윈7,윈XP) (0) | 2015.11.21 |
HTML5 오디오 404 오류시 다른 파일 재생 (0) | 2015.07.29 |
댓글