file_get_contents () не работает для URL продукта Amazon

Я хочу получить некоторые данные со страницы http://www.amazon.com/gp/offer-listing/B00PCPU9D6/ref=dp_olp_new?ie=UTF8&состояние = новый

но file_get_content () не может получить эти данные. Я получаю ниже ошибки.

Предупреждение: file_get_contents (http://www.amazon.com/gp/offer-listing/B00PCPU9D6/ref=dp_olp_new?ie=UTF8&состояние = новый) [function.file-get-contents]: не удалось открыть поток: сбой HTTP-запроса! HTTP / 1.1 503 Служба недоступна в C: \ wamp \ www \ xx \ ajax \ testlist.php в строке 5

Текущий код:

    <?php
$req = "http://www.amazon.com/gp/offer-listing/B00PCPU9D6/ref=dp_olp_new?ie=UTF8&condition=new";
$html = file_get_contents($req);
echo htmlentities($html);
print_r($html);

libxml_use_internal_errors( true);

$doc = new DOMDocument;

$doc->loadHTML( $html);

$xpath = new DOMXpath( $doc);
for($i=0;$i<10;$i++)

{

$node = $xpath->query( '//div[@class="a-column a-span2"]//span[@class="a-size-large a-color-price olpOfferPrice a-text-bold"]')->item($i);

$pricetxt = $node->textContent; // This will print **GET THIS TEXT**

$pricett = substr($pricetxt,10, 11);

$pricestr .= (float)$pricett."|";

}

$pricestr = rtrim($pricestr,"|");
echo $pricestr;
?>

Кто-нибудь, пожалуйста, помогите мне .. Если у вас есть какое-либо другое решение, пожалуйста, скажите мне.

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector