Как прочитать файл по адресу:
https://www[dot]ripe[dot]net/fcgi-bin/wh[dot][dot][dot]xt=81[dot]30[dot]217[dot]248
Функция fopen() не хочет читать протокол https
1. Гость - 03 Августа, 2006 - 09:10:57 - перейти к сообщению
2. valenok - 03 Августа, 2006 - 09:14:06 - перейти к сообщению
Директиву allow_url_fopen в php ini поставьте на On
3. Гость - 03 Августа, 2006 - 09:28:22 - перейти к сообщению
Она влкючена.\n\n(Добавление)
Вот сам скрипт:
<?php
function get_content($link)
{
$fd = fopen($link, "r");
$text="";
if (!$fd) echo "Запрашиваемая страница не найдена";
else
{
// Чтение содержимого файла в переменную $text
while (!feof ($fd)) $text .= fgets($fd, 4096);
}
// Закрыть открытый файловый дескриптор
fclose ($fd);
return $text;
}
$text = get_content('https://www.ripe.net/fcgi-bin/whois?form_type=simple&full_query_string=&searchtext=81.30.217.248');
echo $text;
?>
Что он выдает:
Notice: fopen() [function.fopen]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in C:TopServerwwwvirtualprimeip.php on line 8
Warning: fopen(https://www.ripe.net/fcgi-bin/whois?form_type=simple&full_query_string=&searchtext=81.30.217.248) [function.fopen]: failed to open stream: Invalid argument in C:TopServerwwwvirtualprimeip.php on line 8
Запрашиваемая страница не найдена
Warning: fclose(): supplied argument is not a valid stream resource in C:TopServerwwwvirtualprimeip.php on line 17
\n\n(Добавление)
О, оказывается там можно и по http протоколу открыть станичку.
Но вопрос остается открытым, можно ли прочитать по https.
Вот сам скрипт:
<?php
function get_content($link)
{
$fd = fopen($link, "r");
$text="";
if (!$fd) echo "Запрашиваемая страница не найдена";
else
{
// Чтение содержимого файла в переменную $text
while (!feof ($fd)) $text .= fgets($fd, 4096);
}
// Закрыть открытый файловый дескриптор
fclose ($fd);
return $text;
}
$text = get_content('https://www.ripe.net/fcgi-bin/whois?form_type=simple&full_query_string=&searchtext=81.30.217.248');
echo $text;
?>
Что он выдает:
Notice: fopen() [function.fopen]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in C:TopServerwwwvirtualprimeip.php on line 8
Warning: fopen(https://www.ripe.net/fcgi-bin/whois?form_type=simple&full_query_string=&searchtext=81.30.217.248) [function.fopen]: failed to open stream: Invalid argument in C:TopServerwwwvirtualprimeip.php on line 8
Запрашиваемая страница не найдена
Warning: fclose(): supplied argument is not a valid stream resource in C:TopServerwwwvirtualprimeip.php on line 17
\n\n(Добавление)
О, оказывается там можно и по http протоколу открыть станичку.
Но вопрос остается открытым, можно ли прочитать по https.
4. ARTY - 03 Августа, 2006 - 22:13:25 - перейти к сообщению
С протоколом https работает библиотека CURL:
http://php.su/functions/?cat=curl
Слышал, что существуют и другие библиотеки, также поддерживающие https.
http://php.su/functions/?cat=curl
Слышал, что существуют и другие библиотеки, также поддерживающие https.