Hi,
when I use the Shopify API direct without curl, I get all items.
orders.json?ids=4860525019298,4831616499874,4785159143586,4784217981090,4776692842658,4579539517602,4579452256418,4579443507362,4579415851170,4579406774434,4579403563170,4574627463330&limit=250&status=any
When if from rest_api only 5 items.
public function rest_api($url, $query = array(), $method = 'GET') {
$url = 'https://' . $this->shop_url . "/admin/api/" . $this->api_endpoint ."/". $url;
if(in_array($method, array('GET', 'DELETE')) && !is_null($query)) {
//$url = $url . '?' . http_build_query($query);
}
echo "
". $url. "
";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_MAXREDIRS, 20);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 1000);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
$headers = array();
$headers[] = "Content-Type: application/json";
if(!is_null($this->access_token)) {
$headers[] = "X-Shopify-Access-Token: " . $this->access_token;
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
}
if( $method != 'GET' && in_array($method, array('POST', 'PUT'))) {
if(is_array($query)){
$query = json_encode($query);
}
curl_setopt($curl, CURLOPT_POSTFIELDS, $query);
}
$response = curl_exec($curl);
$error = curl_errno($curl);
$error_msg = curl_error($curl);
curl_close($curl);
if($error) {
return $error_msg;
}
else {
$response = preg_split("/\r\n\r\n|\n\n|\r\r/", $response, 2);
//echo print_r($response);
$headers = array();
$headers_content = explode("\n", $response[0]);
$headers['status'] = $headers_content[0];
array_shift($headers_content);
foreach($headers_content as $content) {
$data = explode(':', $content);
$headers[ trim( $data[0] ) ] = trim( $data[1] );
}
return array('headers' => $headers, 'body' => $response[1]);
}
}