Php unable to find socket transport http

Php unable to find socket transport http

Профиль
Группа: Участник
Сообщений: 9
Регистрация: 28.1.2007

При обращении к fsockopen() вылазит вот это:

Warning: fsockopen() [function.fsockopen]: unable to connect to http://ya.ru:80 (Unable to find the socket transport «http» — did you forget to enable it when you configured PHP?) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\t.php on line 45

Не подскажите, как это решается?

Это сообщение отредактировал(а) MAQrus — 16.3.2008, 08:08

Профиль
Группа: Участник
Сообщений: 2641
Регистрация: 11.12.2007

Задавая вопрос, следует приводить код, который вызвал сообщение об ошибке.
Используя функцию РНР, следует читать её описание в документации. И подставлять в переметры то, что там написано.

Профиль
Группа: Участник
Сообщений: 9
Регистрация: 28.1.2007

Код
$header = ‘GET / HTTP/1.1 \r\n’;
$header .= ‘Host: ya.ru \r\n’;
$header .= ‘Accept: */* \r\n’;
$header .= ‘Accept-Language: ru \r\n’;
$response = »;
$sock = fsockopen(‘http://ya.ru’, 80, $errno, $errstr, 30);
if(!$sock) die(‘Не могу соединиться!’);
if(!fwrite($sock, $header)) die(‘Не могу послать данные!’);
while($res = fread($sock, 1024))
$response .= $res;

Описания функции читал, но не могу понять, где моя ошибка, может при установке PHP где-то накосячил?

Профиль
Группа: Участник
Сообщений: 375
Регистрация: 14.8.2007
Где: Москва

Цитата
Example#1 fsockopen()
$fp = fsockopen(«www.example.com», 80, $errno, $errstr, 30);
if (!$fp) echo «$errstr ($errno)
\n»;
> else $out = «GET / HTTP/1.1\r\n»;
$out .= «Host: www.example.com\r\n»;
$out .= «Connection: Close\r\n\r\n»;

Было бы крайне странно, если бы можно было одновременно указывать и http:// etc. и номер порта.

Добавлено через 2 минуты и 15 секунд
Перед доменом можно поставить и имя протокола, но там более низкий уровень, который вам врядли нужен, поможет http://ru2.php.net/manual/en/function.stre. -transports.php.

Профиль
Группа: Участник
Сообщений: 9
Регистрация: 28.1.2007

  • PHP редакторы собираются и обсуждаются здесь
  • Электронные книги по PHP, документацию можно найти здесь
  • Интерпретатор PHP, полную документацию можно скачать на PHP.NET
  • Не брезгуйте пользоваться тегами [code=php]КОД[/code] для повышения читабельности текста/кода.
  • Перед созданием новой темы воспользуйтесь поиском и загляните в FAQ
  • Действия модераторов можно обсудить здесь
  • Темы «ищу скрипт», «подскажите скрипт» и т.п. будут переноситься в форум «Web-технологии»
  • Темы с именами: «Срочно», «помогите», «не знаю как делать» будут УДАЛЯТЬСЯ

Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, [email protected] , skyboy, SamDark, MoLeX, awers.

0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | PHP: Общие вопросы | Следующая тема »

[ Время генерации скрипта: 0.0980 ] [ Использовано запросов: 21 ] [ GZIP включён ]

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to find the socket transport «HTTP» #71

Unable to find the socket transport «HTTP» #71

Comments

Trying to install composer and can’t get beyond this error, installed xampp before trying to run this install. Any help would be appreciated! Thanks

2017-06-22 11:24:07.367 Log opened. (Time zone: UTC-05:00)
2017-06-22 11:24:07.367 Setup version: Inno Setup version 5.5.9 (u)
2017-06-22 11:24:07.367 Original Setup EXE: C:\Users\xxxxxx\Downloads\Composer-Setup.4.5.0.exe
2017-06-22 11:24:07.367 Setup command line: /SL5=»$60904,290864,121344,C:\Users\tm517n\Downloads\Composer-Setup.4.5.0.exe» /SPAWNWND=$40902 /NOTIFYWND=$70778
2017-06-22 11:24:07.367 Windows version: 6.1.7601 SP1 (NT platform: Yes)
2017-06-22 11:24:07.367 64-bit Windows: Yes
2017-06-22 11:24:07.367 Processor architecture: x64
2017-06-22 11:24:07.367 User privileges: Administrative
2017-06-22 11:24:07.371 64-bit install mode: No
2017-06-22 11:24:07.374 Created temporary directory: C:\Users\xxxxxx\AppData\Local\Temp\is-F8GEA.tmp
2017-06-22 11:24:07.377 Extracting temporary file: C:\Users\xxxxxx\AppData\Local\Temp\is-F8GEA.tmp\check.php
2017-06-22 11:24:07.378 Extracting temporary file: C:\Users\xxxxxx\AppData\Local\Temp\is-F8GEA.tmp\installer.php
2017-06-22 11:24:07.390 Extracting temporary file: C:\Users\xxxxxx\AppData\Local\Temp\is-F8GEA.tmp\composer
2017-06-22 11:24:07.391 $ Getting path info from registry
2017-06-22 11:24:07.394 $ Found http_proxy in System environment
2017-06-22 11:24:07.394 $ Found https_proxy in System environment
2017-06-22 11:24:10.699 $ Checking selected php: C:\xampp\php\php.exe
2017-06-22 11:24:10.699 $ — Execute File —
2017-06-22 11:24:10.699 $ Running «C:\xampp\php\php.exe» -v
2017-06-22 11:24:10.841 $ Success: exit code [0]
2017-06-22 11:24:10.841 $ — Execute File —
2017-06-22 11:24:10.841 $ Running «C:\Windows\system32\cmd.exe» /c «C:\xampp\php\php.exe check.php > C:\Users\xxxxxx\AppData\Local\Temp\is-F8GEA.tmp\stdout.txt 2> C:\Users\tm517n\AppData\Local\Temp\is-F8GEA.tmp\stderr.txt»
2017-06-22 11:24:10.949 $ Success: exit code [0]
2017-06-22 11:24:10.952 $ Details: version 5.6.28, tls = 1, ini = C:\xampp\php\php.ini
2017-06-22 11:24:10.954 $ Checking php path
2017-06-22 11:24:10.954 $ Checking composer bin path
2017-06-22 11:24:10.954 $ Registering: Add to System path: C:\ProgramData\ComposerSetup\bin
2017-06-22 11:24:10.954 $ Checking PathExt values for .BAT
2017-06-22 11:24:10.955 $ Registering: Add to User path: C:\Users\xxxxxx\AppData\Roaming\Composer\vendor\bin
2017-06-22 11:24:14.699 $ Running Composer installer script
2017-06-22 11:24:14.701 $ — Execute File —
2017-06-22 11:24:14.701 $ Running «C:\Windows\system32\cmd.exe» /c «C:\xampp\php\php.exe installer.php — —no-ansi —quiet > C:\Users\xxxxxx\AppData\Local\Temp\is-F8GEA.tmp\stdout.txt 2> C:\Users\xxxxxx\AppData\Local\Temp\is-F8GEA.tmp\stderr.txt»
2017-06-22 11:24:14.914 $ Success: exit code [1]
2017-06-22 11:24:14.918 $ Error: [ERR_INSTALL_ERRORS]
The «https://getcomposer.org/versions» file could not be downloaded: failed to open stream: Unable to find the socket transport «HTTP» — did you forget to enable it when you configured PHP?

The text was updated successfully, but these errors were encountered:

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to find the socket transport «HTTP» #71

Unable to find the socket transport «HTTP» #71

Comments

Trying to install composer and can’t get beyond this error, installed xampp before trying to run this install. Any help would be appreciated! Thanks

2017-06-22 11:24:07.367 Log opened. (Time zone: UTC-05:00)
2017-06-22 11:24:07.367 Setup version: Inno Setup version 5.5.9 (u)
2017-06-22 11:24:07.367 Original Setup EXE: C:\Users\xxxxxx\Downloads\Composer-Setup.4.5.0.exe
2017-06-22 11:24:07.367 Setup command line: /SL5=»$60904,290864,121344,C:\Users\tm517n\Downloads\Composer-Setup.4.5.0.exe» /SPAWNWND=$40902 /NOTIFYWND=$70778
2017-06-22 11:24:07.367 Windows version: 6.1.7601 SP1 (NT platform: Yes)
2017-06-22 11:24:07.367 64-bit Windows: Yes
2017-06-22 11:24:07.367 Processor architecture: x64
2017-06-22 11:24:07.367 User privileges: Administrative
2017-06-22 11:24:07.371 64-bit install mode: No
2017-06-22 11:24:07.374 Created temporary directory: C:\Users\xxxxxx\AppData\Local\Temp\is-F8GEA.tmp
2017-06-22 11:24:07.377 Extracting temporary file: C:\Users\xxxxxx\AppData\Local\Temp\is-F8GEA.tmp\check.php
2017-06-22 11:24:07.378 Extracting temporary file: C:\Users\xxxxxx\AppData\Local\Temp\is-F8GEA.tmp\installer.php
2017-06-22 11:24:07.390 Extracting temporary file: C:\Users\xxxxxx\AppData\Local\Temp\is-F8GEA.tmp\composer
2017-06-22 11:24:07.391 $ Getting path info from registry
2017-06-22 11:24:07.394 $ Found http_proxy in System environment
2017-06-22 11:24:07.394 $ Found https_proxy in System environment
2017-06-22 11:24:10.699 $ Checking selected php: C:\xampp\php\php.exe
2017-06-22 11:24:10.699 $ — Execute File —
2017-06-22 11:24:10.699 $ Running «C:\xampp\php\php.exe» -v
2017-06-22 11:24:10.841 $ Success: exit code [0]
2017-06-22 11:24:10.841 $ — Execute File —
2017-06-22 11:24:10.841 $ Running «C:\Windows\system32\cmd.exe» /c «C:\xampp\php\php.exe check.php > C:\Users\xxxxxx\AppData\Local\Temp\is-F8GEA.tmp\stdout.txt 2> C:\Users\tm517n\AppData\Local\Temp\is-F8GEA.tmp\stderr.txt»
2017-06-22 11:24:10.949 $ Success: exit code [0]
2017-06-22 11:24:10.952 $ Details: version 5.6.28, tls = 1, ini = C:\xampp\php\php.ini
2017-06-22 11:24:10.954 $ Checking php path
2017-06-22 11:24:10.954 $ Checking composer bin path
2017-06-22 11:24:10.954 $ Registering: Add to System path: C:\ProgramData\ComposerSetup\bin
2017-06-22 11:24:10.954 $ Checking PathExt values for .BAT
2017-06-22 11:24:10.955 $ Registering: Add to User path: C:\Users\xxxxxx\AppData\Roaming\Composer\vendor\bin
2017-06-22 11:24:14.699 $ Running Composer installer script
2017-06-22 11:24:14.701 $ — Execute File —
2017-06-22 11:24:14.701 $ Running «C:\Windows\system32\cmd.exe» /c «C:\xampp\php\php.exe installer.php — —no-ansi —quiet > C:\Users\xxxxxx\AppData\Local\Temp\is-F8GEA.tmp\stdout.txt 2> C:\Users\xxxxxx\AppData\Local\Temp\is-F8GEA.tmp\stderr.txt»
2017-06-22 11:24:14.914 $ Success: exit code [1]
2017-06-22 11:24:14.918 $ Error: [ERR_INSTALL_ERRORS]
The «https://getcomposer.org/versions» file could not be downloaded: failed to open stream: Unable to find the socket transport «HTTP» — did you forget to enable it when you configured PHP?

The text was updated successfully, but these errors were encountered:

Источник

php — Unable to find the socket transport «http» when creating stream with proxy

I have been making a POST request to the remote server, to scrape data from that site, I was been using some 3rd party lib. like guzzle and Request HTTP client (as it was very tiny yet powerful) for making a POST request on the
remote site, but due to some issues, I decided of using PHP native function or cURL. I compared both, found file_get_contents() is that function, that I was looking for. then I hooked into PHP Stream to create a POST request. I’m using proxy lands proxy Service. after implementing proxy, my tiny bot gets stuck (without proxy it’s was working fine before) and I’m getting an error Unable to find the socket transport «http» — did you forget to enable it when you configured PHP? in C:\wamp64\www\Botoop1.1\lib\httpRequestInterface.php on line 10 here is the stream code Note: the site which I’m trying to fetch is with https based

 $opts = array( 'http' => [ 'method' => $method, 'header' => $this->headers, 'content' => $this->postDataToHttpBuildQuery($postData), 'proxy' => 'http://FV0JDn87s9i0hWU:[email protected]:9090', 'request_fulluri' => true ], 'ssl' => [ "verify_peer" => "false", "verify_peer_name" => "false" ] 

Update Here: by removing the tcp:// that warning message has been gone.

Share solution ↓

Additional Information:

Didn’t find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Similar questions

Find the answer in similar questions on our website.

Источник

Читайте также:  Built in cpp reference
Оцените статью