curl으로 htts 사이트에 로그인 시 You must pass either an object or an array with the CURLOPT_HTTPHEADER argument

curl으로 htts 사이트에 로그인 시 You must pass either an object or an array with the CURLOPT_HTTPHEADER argument

QA

curl으로 htts 사이트에 로그인 시 You must pass either an object or an array with the CURLOPT_HTTPHEADER argument

답변 1

본문

curl 를 통한 로그인 후 특정 페이지에서 정보를 가져오려합니다. 


<?
$url    = 'https://그누보드 제작 사이트/bbs/login_check.php';
$agent  = "Mozilla/5.0 (iPad; CPU OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53";
$cookie = "cookie.txt";
$Submit['mb_id'] = "admin";
$Submit['mb_password'] = "aaa";
    $Curl = curl_init();
curl_setopt($Curl, CURLOPT_URL, $url);
curl_setopt($Curl, CURLOPT_HTTPHEADER, 1);
curl_setopt($Curl, CURLOPT_USERAGENT, $agent);
//curl_setopt($Curl, CURLOPT_SSLVERSION, 3); // SSL 버젼 (https 접속시에 필요)
curl_setopt($Curl, CURLOPT_SSL_VERIFYPEER, true); // 인증서 체크
curl_setopt($Curl, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($Curl, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($Curl, CURLOPT_POST, 1);
curl_setopt($Curl, CURLOPT_POSTFIELDS, $Submit);
curl_setopt($Curl, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($Curl);
    curl_close($Curl);

echo $result;
?>

 

 

접속하니 ...

Warning: curl_setopt(): You must pass either an object or an array with the CURLOPT_HTTPHEADER argument in /curlConn.php on line 12

 

CURLOPT_HTTPHEADER 1, true, false 모두 넣어도 동일한 Warning 이 나오는데요

왜그런건지??

 

로그인되었을 때와 실패되었을 때 어떻게 구분되는건지요?

이 질문에 댓글 쓰기 :

답변 1

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 534
© SIRSOFT
현재 페이지 제일 처음으로