0
다음 코드를 사용하여 일부 Json을 집계하기 위해 POST 요청을 웹 사이트에 보냅니다. 나는 성공했다. 단지 부분적인 데이터 만 얻는다. Json에는 두 개의 객체가 포함되어 있어야합니다. 처음 완성되었습니다. 두 번째 문자열은 매우 긴 문자열로, 그 시작 부분 만 가져옵니다.POST 및 cURL을 사용하여 PHP로 데이터를 가져 오는 PHP는 부분 데이터를 가져옵니다.
나는 반환 값이나 무언가의 최대 길이를 정의 할 필요가 있다고 생각했지만 다른 코드를 가진 동일한 코드는 매우 긴 문자열에도 문제가없는 다른 Jsons를 얻는다.
누군가 내가 여기에없는 것을 이해할 수 있도록 도와 줄 수 있습니까?
$header = array();
$header[] = 'Accept:application/json, text/javascript, */*; q=0.01';
$header[] = 'Accept-Encoding:gzip,deflate,sdch';
$header[] = 'Accept-Language:en-US,en;q=0.8,he;q=0.6,ru;q=0.4';
$header[] = 'Connection:keep-alive';
$header[] = 'Host:www.host.com';
$header[] = 'Origin:http://www.origin.com';
$header[] = 'Referer:http://www.site.com/something/';
$header[] = 'X-Requested-With:XMLHttpRequest';
$data = "neededData...";
$process = curl_init($url);
curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers);
curl_setopt($process, CURLOPT_HEADER, $this->headers_html);
curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent);
if ($this->cookies == TRUE)
curl_setopt($process, CURLOPT_COOKIEFILE, $this->cookie_file);
if ($this->cookies == TRUE)
curl_setopt($process, CURLOPT_COOKIEJAR, $this->cookie_file);
curl_setopt($process, CURLOPT_ENCODING, $this->compression);
curl_setopt($process, CURLOPT_TIMEOUT, $this->timeout);
curl_setopt($process, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($process, CURLOPT_POSTFIELDS, $data);
curl_setopt($process, CURLOPT_POST, 1);
$return = curl_exec($process);
다른 도구로 요청을 시도 했습니까? 예 : unix curl? – user1658078
Nope. 그냥 HTML 양식으로 시도 .. 작동합니다. –
약간의 테스트로 똑같은 코드가 나에게 리눅스에서 완전한 Json을 얻었지만 Windows에서는 그렇지 못했다. –