我是新来的,我需要知道如何使用php中的内容范围下载项目,并在1秒内下载25个项目。
我这样做:
<?php
ini_set('default_charset', 'utf-8');
include ("bdd_connect.con");
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar\r\n" .
"Range: items=0-100\r\n"
)
);
$context = stream_context_create($opts);
$response = file_get_contents("http://www.google.pt", false, $context);
//echo($response);
$data = json_decode($response, true);
echo count($data);
//print_r($data);
$keepers = array();
foreach ($data as $item) {
//$keepers[] = $item;
print_r($item['publicationDate']);
}
?>