[질문] libcurl을 사용해서 파란에 로긴을 하고 싶습니다.. 소스좀 봐주세요~~

zoomout150의 이미지

안녕하세요~~
답답한 마음에 글을 올립니다.

파란에서 공짜로 제공하는 SMS 서비스로 로긴하여 SMS를 날리려고 하거든요..
그런데 첫 단계인 로긴하는 부분부터 막히네요 ㅡㅜ

쿠키가 만들어 지지도 않고... 로긴도 안되고... 접속해서 데이터를 받다가 뻣는것 같습니다.
제가 워낙 네트웍 지식이 빈약해서 해결할 실마리가 안보이네요 ㅡㅜ

도와주세요~~~~
더불어서 도움이 될만한 책이 있다면 추천 부탁드립니다 ^^;

int main(int argc, char** argv)
{
	const char* strTargetUrl = "http://main.paran.com/mainAction.do?method=paranMainLogin";
	const char* strPostFilds = "http%3A%2F%2Fmailsms.paran.com&wbSurl=http%3A%2F%2Fmailsms.paran.com&wbUserid=아이디&wbDomain=paran.com&wbPasswd=비밀번호&wbSecure=1&x=49&y=10";
	const char* strReferer = "http://mailsms.paran.com/";
 
	curl_global_init( CURL_GLOBAL_ALL ) ; 
 
	CURL* ctx = curl_easy_init() ; 
 
	if( NULL == ctx ){ 
		std::cerr << "Unable to initialize cURL interface" << std::endl ; 
		return( ERROR_CURL_INIT ) ; 
	} 
 
	curl_easy_setopt(ctx, CURLOPT_HEADER, 1);
	curl_easy_setopt(ctx, CURLOPT_POST, 1);
	curl_easy_setopt(ctx, CURLOPT_POSTFIELDS, strPostFilds);
	curl_easy_setopt(ctx, CURLOPT_REFERER, strReferer) ;
	curl_easy_setopt(ctx, CURLOPT_TIMEOUT, 100);
	curl_easy_setopt(ctx, CURLOPT_COOKIEJAR, "D:\\");
	curl_easy_setopt(ctx, CURLOPT_COOKIEFILE, "D:\\XXX.txt");
	curl_easy_setopt(ctx , CURLOPT_WRITEDATA , stdout); 
	curl_easy_setopt(ctx, CURLOPT_URL, strTargetUrl);
	curl_slist* responseHeaders = NULL ;
	responseHeaders = curl_slist_append( responseHeaders , "User-Agent: Mozilla" ) ; 
	curl_easy_setopt(ctx , CURLOPT_HTTPHEADER , responseHeaders) ; 
	curl_easy_setopt(ctx, CURLOPT_VERBOSE, 1);
 
	std::cout << "- - - BEGIN: response - - -" << std::endl ; 
	CURLcode rc = curl_easy_perform(ctx) ; 
	std::cout << "- - - END: response - - -" << std::endl ; 
 
	if( CURLE_OK != rc ){ 
		std::cerr << "Error from cURL: " << curl_easy_strerror( rc ) << std::endl ; 
	} 
 
	curl_easy_cleanup(ctx) ; 
	curl_global_cleanup() ; 
	std::exit( 0 ) ; 
	return 0;
}

zoomout150의 이미지

페이지가 이상해졌네요 ...
인클루드한 파일 부분이 빠진것 같아서 편집하려고 하는데 인클루드는 한번만 해야 한다는 에러가...
ㅎㄷㄷ..

인클루드 파일은 컴파일 되기 위한 기본파일들만 했구요.
윈도우에서 VS 2003/2008로 해봤습니다.

쿠키파일도 생성이 안되네요 ㅠㅠ

제발 도와주세요~~~

silasoni의 이미지

일단 strPostFilds 이 틀린거 같은데요?

zoomout150의 이미지

Post로 보내는 필드가 잘못된건가요??

나름대로 패킷 캡쳐한 대로 넣었다고 생각을 했는데...

확인해보니 캡쳐한 내용과 완전히 동일합니다 ㅡㅜ

다만 차이점은 쿠키부분인데...

쿠키가 생성되지 않네요 ㅠㅠ

블루스크린의 이미지

코드를 올리실때는 < c o d e > < / c o d e > 블럭 안에 넣어주세요 - 스페이스는 빼고 입력하세요
---------------------------------------------------------------------------------------------------------
이 댓글(comment)의 수정 및 삭제를 위해 이 글에 답글(reply)를 달지말고 원 글에 댓글(comment)로 달아주세요

-------------------------------------------------------------------------------
이 댓글(comment)의 수정 및 삭제를 위해 이 글에 답글(reply)을 쓰지 말아 주십시요.
의견이 있으시면 원 글에 댓글(comment)로 써 주세요.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.