2017-05-01 18 views
0

Zend HTTP Client無効なURIが指定されていますか?私は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&regularPrice&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?

編集: In PostManまたはブラウザの要求で、適切なデータが送信されます。

答えて

1

あなたが変更することができます。

$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&regularPrice&salePrice&upc&modelNumber&image&largeFrontImage&mediumImage&thumbnailImage&largeImage&shortDescription&longDescription')); 

$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&regularPrice&salePrice&upc&modelNumber&image&largeFrontImage&mediumImage&thumbnailImage&largeImage&shortDescription&longDescription'); 
$response = $bestBuyClient->request(); 

を作品場合は私に知らせてください:)。

+0

OMG、その作業... D:Dあなたは私を救った。 – AWE

関連する問題