출처: http://gyeongju.tistory.com/entry/SUNAPI-10-사용자인증-digest-인증방법-C?category=519528 [Joo의 블로그 :D]
C++ digest authentication, digest 인증, 사용자 인증
카메라제어방법은 SUNAPI1.0 문서를 참고하면 된다.
아래 예시는 카메라의 PTZ(Pan, Tilt, Zoom)를 제어하는 방법이다.
#include "stdafx.h"
#using <System.dll>
using namespace System;
using namespace System::Net;
using namespace System::Text;
using namespace System::IO;
int _tmain(int argc, _TCHAR* argv[])
{
array<String^>^args = Environment::GetCommandLineArgs();
HttpWebRequest^ request = dynamic_cast<HttpWebRequest^>(WebRequest::Create(URL));
// URL : "http://192.168.0.4/cgi-bin/ptz.cgi?move=absmove&pan=50&tilt=90&zoom=5"
// Set some reasonable limits on resources used by this request
request->MaximumAutomaticRedirections = 4;
request->MaximumResponseHeadersLength = 4;
// Set credentials to use for this request.
request->Credentials = gcnew NetworkCredential(User ID, PASSWORD);
HttpWebResponse^ response = dynamic_cast<HttpWebResponse^>(request->GetResponse());
Console::WriteLine( "Content length is {0}", response->ContentLength );
Console::WriteLine( "Content type is {0}", response->ContentType );
// Get the stream associated with the response.
Stream^ receiveStream = response->GetResponseStream();
// Pipes the stream to a higher level stream reader with the required encoding format.
StreamReader^ readStream = gcnew StreamReader( receiveStream,Encoding::UTF8 );
Console::WriteLine( "Response stream received." );
Console::WriteLine( readStream->ReadToEnd() );
response->Close();
readStream->Close();
return 0;
}
출처: http://gyeongju.tistory.com/entry/SUNAPI-10-사용자인증-digest-인증방법-C?category=519528 [Joo의 블로그 :D]
'언어 > WEB' 카테고리의 다른 글
highlight.js를 이용하여 티스토리 블로그에서 코드 문법 강조(syntax highlighting) (0) | 2018.03.18 |
---|---|
CCZ-CROSS 스킨 (0) | 2018.03.18 |