PHP 5 Unable to Open HTTP Request Stream with fopen or fsockopen Functions PHP 5 Не вдається відкрити запит HTTP Stream з FOPEN або fsockopen функції

With Apache/2.xx or Apache/2.2.x webserver, with PHP5 as the scripting module, a HTTP communication error may occur within the PHP scripts that are parsing and running via the web server. З Apache/2.xx або Apache/2.2.x веб-сервер, з PHP5 як сценарії модуля, помилка HTTP зв'язку можуть відбуватися і в PHP скриптах, які розбору і працює через веб-сервер.

The errors that generated by PHP include: Помилки, породжені РНР включають в себе:

PHP Warning: fopen(http://www.example.com): failed to open stream: HTTP request failed! Warning: FOPEN (http://www.example.com): не зумів розкрити потік: HTTP запиту Failed!
fsockopen(): unable to connect to … fsockopen (): Не вдається підключитися до ...
file_get_contents(): failed to open stream: HTTP request failed! file_get_contents (): не зумів розкрити потік: HTTP запиту Failed!
PHP Warning: main(): Failed opening 'http://www.example.com/index.html' for inclusion … PHP Warning: require_once (): Failed відкриття "http://www.example.com/index.html 'для включення ...
PHP Warning: include(/usr/local/index.php): failed to open stream: No such file or directory in … Warning: включити (/ USR / місцеві / index.php): не зумів розкрити потік: Відсутність такого файлу або каталогу в ...

To resolve the problem, ensure that allow_url_fopen is enabled in PHP.INI configuration file. Щоб вирішити проблему, переконайтеся, що опція allow_url_fopen включена у файлі конфігурації php.ini. The line should look like this: Рядок повинен виглядати так:

allow_url_fopen = On allow_url_fopen = О

Note: Depending on your system OS and configuration, the PHP.INI is located at various varied location, such as in Apache bin directory for Windows system or /usr/local/etc in FreeBSD Apache installation, if you don't specify or point to PHP.INI in another directory. Примітка: В залежності від вашої системи та конфігурації ОС, знаходиться php.ini на різних різноманітні місця, наприклад в Apache бен каталозі Windows System або / USR / місцеві / та ін при встановленні FreeBSD Apache, якщо ви не вказали або точка в php.ini в іншому каталозі.

If the error still happen and the PHP scripts still unable to connect to remote external servers and thus unable to download updates or retrieve files, check the user_agent setting in PHP.ini. Якщо проблеми все ще може статися і PHP скрипти ще не вдається підключитися до віддаленого зовнішніх серверах і, отже, не може завантажити оновлення і витягати файли, перевірити user_agent налаштування в php.ini.

By default php.ini set the user_agent to “PHP” which signifies that it's the script that try to access the web server. За замовчуванням php.ini встановити user_agent до "PHP", що означає, що це сценарій, який намагається отримати доступ до веб-сервера. Some web servers will refuse and don't allow script to access and receive the date from the server. Деякі веб-сервери будуть відмовляти і не дозволяють сценарій для доступу і отримати дату з сервера. So, by setting the user_agent to that of a web browser, PHP will let the web server know which kind of web browser will receive the date, and thus able to open the HTTP connection stream. Таким чином, встановивши user_agent до цього веб-браузер, PHP дозволить веб-сервера знати, який тип веб-браузера буде отримувати дату і, таким чином вдалося відкрити потік HTTP з'єднання.

The user_agent can be set to any kind of browser strings, for example of Internet Explorer: User_agent може бути встановлений на будь-який рядку браузера, наприклад, в Internet Explorer:

user_agent=”Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)” user_agent = "Mozilla/4.0 (сумісний; MSIE 6.0; Windows NT 5.0)"

IMPORTANT : The page is machine translated and provided "as is" without warranty. ВАЖЛИВО: Сторінка машина переведена і надаються "як є" без гарантії. Machine translation may be difficult to understand. Машинний переклад може бути важким для розуміння. Please refer to Будь ласка, зверніться до original English article оригінальний англійська статтю whenever possible. коли це можливо.


5 Responses to “PHP 5 Unable to Open HTTP Request Stream with fopen or fsockopen Functions” 5 Відповідь до "PHP 5 Не вдається відкрити запит HTTP Stream з FOPEN або fsockopen функції"

  1. Tarandeep Tarandeep
    March 28th, 2009 00:40 28 березня 2009 00:40
    5 5

    It did not work for me… Це не робота для мене ...

  2. Vladimir Володимир
    February 25th, 2009 15:05 25 лютого 2009 15:05
    4 4

    Thank you a lot for info. Спасибі, дуже багато для інформації.
    Things with Речі з
    user_agent=”Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)” user_agent = "Mozilla/4.0 (сумісний; MSIE 6.0; Windows NT 5.0)"
    helped допомогли

  3. Rob Роб
    November 30th, 2008 03:22 30 листопада 2008 03:22
    3 3

    I solved the problem too. Я вирішив проблему теж. Default parameter on Sme Server 7.3 allow_url_fopen = Off .. За замовчуванням параметр по МСП Server 7.3 allow_url_fopen = Off .. Thank you Спасибо :)

  4. Module Модуль
    November 14th, 2008 20:51 14 листопада 2008 20:51
    2 2

    Or you can use curl as described here: Або ви можете використовувати Curl, як описано тут: http://toic.org/2008/10/08/fetching-remote-content-with-curl/#more-52 http://toic.org/2008/10/08/fetching-remote-content-with-curl/ # більш-52

  5. totoro Тоторо
    October 6th, 2008 05:33 6 жовтня 2008 05:33
    1 1

    thank you, I solved my problem. Дякую вам, я вирішив мою проблему.
    by default, on openbsd allow_url_fopen = off За умовчанням в OpenBSD allow_url_fopen = Off

Leave a Reply Написати відповідь

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> Ви можете використовувати ці теги: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <справі DateTime = ""> <em> <i> <q Cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. Підписатися на коментарі функція була відключена. To receive notification of latest comments posted, subscribe to Щоб отримувати повідомлення про останні коментарях, підписатися My Digital Life Comments RSS feed Моя Цифрова життя Коментарі RSS Feed or або register to receive Увійдіть, щоб отримувати new comments in daily email digest. нові коментарі в щоденній електронній пошті.
Custom Search

New Articles Нові статті

Incoming Search Terms for the Article Вхідні терміни пошуку для статті

failed to open stream: HTTP request failed! не вдалося відкрити потік: HTTP запиту Failed! - -- failed to open stream: HTTP request failed не вдалося відкрити потік: HTTP Збій запиту - -- file_get_contents failed to open stream file_get_contents не зумів розкрити потік - -- fsockopen php.ini fsockopen php.ini - -- enable fsockopen дозволити fsockopen - -- php http request PHP HTTP-запиту - -- failed to open stream: HTTP request failed! не вдалося відкрити потік: HTTP запиту Failed! - -- php enable fsockopen дозволити fsockopen PHP - -- fsockopen php ini fsockopen INI PHP - -- file_get_contents php.ini file_get_contents php.ini - -- fsockopen enable fsockopen дозволити - -- file_get_contents failed to open stream: HTTP request failed! file_get_contents не вдалося відкрити потік: HTTP запиту Failed! - -- enable fsockopen php дозволити fsockopen PHP - -- php.ini fsockopen php.ini fsockopen - -- php5 fsockopen php5 fsockopen - -- fsockopen php5 fsockopen php5 - -- fopen HTTP request failed FOPEN запиту HTTP Failed - -- enable file_get_contents дозволити file_get_contents - -- HOW TO ENABLE FSOCKOPEN Як включити FSOCKOPEN - -- fopen php.ini FOPEN php.ini - -- enable fopen дозволити FOPEN - -- php open stream PHP відкритим потоком - -- apache fsockopen Apache fsockopen - -- php httprequest PHP HttpRequest - -- "failed to open stream: HTTP request failed!" "Не вдалося відкрити потік: HTTP запиту Failed!" - -- php fsockopen https PHP fsockopen HTTPS - -- file_get_contents HTTP request failed file_get_contents HTTP Збій запиту - -- php fsockopen http PHP HTTP fsockopen - -- php open http stream PHP відкритий потік HTTP - -- enable fsockopen php.ini дозволити fsockopen php.ini - -- fopen failed to open stream: HTTP request failed! FOPEN не вдалося відкрити потік: HTTP запиту Failed! - -- failed to open stream HTTP request failed не вдалося відкрити потік запитів HTTP Failed - -- php.ini fopen php.ini FOPEN - -- php ini fopen PHP INI FOPEN - -- fsockopen apache fsockopen Apache - -- fopen php5 FOPEN php5 - -- user_agent php.ini user_agent php.ini - -- open stream php Відкрито PHP потоку - -- enable fsockopen() дозволити fsockopen () - -- allow_url_fopen fsockopen allow_url_fopen fsockopen - -- failed to open stream: HTTP request failed не вдалося відкрити потік: HTTP Збій запиту - -- php.ini user_agent php.ini user_agent - -- php HTTP request failed PHP HTTP запиту Failed - -- failed to open stream: HTTP request failed file_get_contents не вдалося відкрити потік: HTTP запиту Failed file_get_contents - -- php file_get_contents HTTP request failed PHP file_get_contents HTTP Збій запиту - -- fsockopen php enable fsockopen PHP дозволити - -- php http request fopen PHP FOPEN запиту HTTP - -- fopen php 5 FOPEN PHP 5 - -- fsockopen() in php fsockopen () в PHP - -- php fsockopen windows PHP fsockopen Windows - -- php5 HttpRequest php5 HttpRequest - -- file_get_contents failed to open stream: HTTP request failed file_get_contents не вдалося відкрити потік: HTTP Збій запиту - -- php open http request PHP HTTP-запит на відкриття - -- php5 http request php5 HTTP-запиту - -- php fopen http PHP HTTP FOPEN - -- fsockopen php 5 fsockopen PHP 5 - -- fopen cannot connect to urls (PHP parameter allow_url_fopen is set to Off) FOPEN не може підключитися до URL (PHP allow_url_fopen параметр має значення Off) - -- php file_get_contents failed to open stream: HTTP request failed! PHP file_get_contents не вдалося відкрити потік: HTTP запиту Failed! - -- php fopen failed to open stream http request failed PHP FOPEN не зумів розкрити потік запитів HTTP Failed - -- php allow fsockopen дозволити fsockopen PHP - -- file_get_contents "failed to open stream: HTTP request failed!" file_get_contents "не вдалося відкрити потік: HTTP запиту Failed!" - -- fsockopen in php fsockopen в PHP - -- fsockopen() enable fsockopen () дозволяють - -- http request stream HTTP-запиту потоку - -- php disable fsockopen PHP відключити fsockopen - -- php stream open PHP потоку відкритим - -- failed to open stream: HTTP request failed! не вдалося відкрити потік: HTTP запиту Failed! HTTP HTTP - -- file_get_contents failed to open stream file_get_contents не зумів розкрити потік - -- php http stream PHP потоків HTTP - -- failed to open stream: HTTP request failed! не вдалося відкрити потік: HTTP запиту Failed! - -- php5 fopen php5 FOPEN - -- file_get_contents failed to open stream http request failed file_get_contents не зумів розкрити потік запитів HTTP Failed - -- php fsockopen php.ini PHP fsockopen php.ini - -- php.ini file_get_contents php.ini file_get_contents - -- HttpRequest php5 HttpRequest php5 - --