Zend HTTP 客户端提供的 URI 无效?
Zend HTTP Client Invalid URI supplied?
我在 URL 上使用 Zend HTTP 时遇到问题:
$bestBuyClient = new Zend_Http_Client('https://api.bestbuy.com/v1/products(search=pizza&salePrice>10&salePrice<15)?apiKey=MyKeyHere&page=1&numItems=10&format=json&show=sku&name&productId&type®ularPrice&salePrice&upc&modelNumber&image&largeFrontImage&mediumImage&thumbnailImage&largeImage&shortDescription&longDescription');
$response = $bestBuyClient->request();
$json="";
if($response->isSuccessful()){
$jsonTxt=$response->getBody();
$json = @json_decode($jsonTxt,true);
}
$jsonProducts=$json;
return $jsonProducts;
出于某种原因,这给了我一个错误:
Invalid URI supplied
这个具体有什么问题 url?
编辑: 在 PostMan 或浏览器请求中发送正确的数据。
你能改变吗:
$bestBuyClient = new Zend_Http_Client('https://api.bestbuy.com/v1/products(search=pizza&salePrice>10&salePrice<15)?apiKey=MyKeyHere&page=1&numItems=10&format=json&show=sku&name&productId&type®ularPrice&salePrice&upc&modelNumber&image&largeFrontImage&mediumImage&thumbnailImage&largeImage&shortDescription&longDescription');
$response = $bestBuyClient->request();
至
$shoppableClient = new Zend_Http_Client(sprintf('https://api.bestbuy.com/v1/products'."%s?%s", urlencode('(search=pizza&salePrice>10&salePrice<15)'), 'apiKey=MyKeyHere&page=1&numItems=10&format=json&show=sku&name&productId&type®ularPrice&salePrice&upc&modelNumber&image&largeFrontImage&mediumImage&thumbnailImage&largeImage&shortDescription&longDescription'));
如果有效请告诉我:).
我在 URL 上使用 Zend HTTP 时遇到问题:
$bestBuyClient = new Zend_Http_Client('https://api.bestbuy.com/v1/products(search=pizza&salePrice>10&salePrice<15)?apiKey=MyKeyHere&page=1&numItems=10&format=json&show=sku&name&productId&type®ularPrice&salePrice&upc&modelNumber&image&largeFrontImage&mediumImage&thumbnailImage&largeImage&shortDescription&longDescription');
$response = $bestBuyClient->request();
$json="";
if($response->isSuccessful()){
$jsonTxt=$response->getBody();
$json = @json_decode($jsonTxt,true);
}
$jsonProducts=$json;
return $jsonProducts;
出于某种原因,这给了我一个错误:
Invalid URI supplied
这个具体有什么问题 url?
编辑: 在 PostMan 或浏览器请求中发送正确的数据。
你能改变吗:
$bestBuyClient = new Zend_Http_Client('https://api.bestbuy.com/v1/products(search=pizza&salePrice>10&salePrice<15)?apiKey=MyKeyHere&page=1&numItems=10&format=json&show=sku&name&productId&type®ularPrice&salePrice&upc&modelNumber&image&largeFrontImage&mediumImage&thumbnailImage&largeImage&shortDescription&longDescription');
$response = $bestBuyClient->request();
至
$shoppableClient = new Zend_Http_Client(sprintf('https://api.bestbuy.com/v1/products'."%s?%s", urlencode('(search=pizza&salePrice>10&salePrice<15)'), 'apiKey=MyKeyHere&page=1&numItems=10&format=json&show=sku&name&productId&type®ularPrice&salePrice&upc&modelNumber&image&largeFrontImage&mediumImage&thumbnailImage&largeImage&shortDescription&longDescription'));
如果有效请告诉我:).