나는 cURL을 사용하여이 사이트에서 결과를 얻으려고합니다. 다운로드 링크가없는 흰색 페이지 만 반환합니다. 내 코드가 잘못된 이유는 무엇입니까?cURL 게시 양식과 결과를 반환
이 내 코드
<?php
// Define URL where the form resides
$form_url = "http://www.tusfiles.net/83gjiu9h49nw";
// This is the data to POST to the form. The KEY of the array is the name of the field. The value is the value posted.
$data_to_post = array();
$data_to_post['op'] = 'download2';
$data_to_post['id'] = '83gjiu9h49nw';
$data_to_post['rand'] = 'utpaxiqp4ocv6krspq5geslurstt7z3bmvt5eqa';
$data_to_post['referer'] = '';
$data_to_post['method_free'] = '';
$data_to_post['method_premium'] = '';
$data_to_post['submit'] = 'Direct download link';
// Initialize cURL
$curl = curl_init();
// Set the options
curl_setopt($curl,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
curl_setopt($curl,CURLOPT_URL, $form_url);
// This sets the number of fields to post
curl_setopt($curl,CURLOPT_POST, sizeof($data_to_post));
// This is the fields to post in the form of an array.
curl_setopt($curl,CURLOPT_POSTFIELDS, $data_to_post);
//execute the post
$result = curl_exec($curl);
//close the connection
curl_close($curl);
?>
당신은 당신의 POST 요청의 본문에 인코딩에게 데이터를 URL에해야 할 수도 들으
왜 필드의 수에'CURLOPT_POST'를 설정합니까? '사실'또는 '거짓'이라고 가정합니다. – Barmar
요청이 성공했는지 확인하려면'$ result'를 확인하십시오. – Barmar
@Barmar curloprt_post 1 또는 0을 변경하려고 시도하고 $ 결과를 표시합니다. 다운로드 링크가 아니라 1을 반환합니다. 무슨 문제 야? –