예, 예, 사용자 및 비밀번호를 알고 있습니다.PHP의 인증 뒤에 웹 사이트에서 페이지를 대량 가져 오는 방법
웹 사이트에 로그인하여 일부 이미지/콘텐츠 (예 : 일반 웹 사이트)를 검색하려면 트릭이 필요합니다.
확실히 curl o file_get_contents로 인증되지 않았기 때문에 분명히 작동하지 않습니다.
내가 어떻게 할 수 있습니까?
인증은 POST가있는 일반 HTTP 인증입니다.
편집 : 도움 감사합니다.
나는, 자신을 인증 쿠키를 내보내고 컬를 통해 그들을 사용하는 사용
//login and set cookie
$curl = curl_init();
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_COOKIEFILE, "cookiefile");
curl_setopt($curl, CURLOPT_COOKIEJAR, "cookiefile"); # SAME cookiefile
curl_setopt($curl, CURLOPT_URL, "url in which there is the login form");
curl_setopt($curl, CURLOPT_POSTFIELDS, "user=test&password=test&someparam=somevalue"); //put here the post/get values
$output = curl_exec($curl);
echo $output;
//finally fetch my content
curl_setopt($curl, CURLOPT_URL, $url_to_fetch);
$output = curl_exec($curl);
echo $output;
curl_close ($curl);
PHP를 사용하여 프로그래밍 방식으로이 작업을 수행해야합니까? 그렇지 않은 경우 wget 등을 사용해보십시오. 웹 사이트는 어떤 종류의 인증을 사용합니까? HTML 양식 또는 HTTP 기본 인증 또는 좀 더 이국적인 것이 있습니까? – fmark