PHP function used to open (Internet or Unix domain) sockets connections.
Questions tagged [fsockopen]
382 questions
7
votes
4 answers
What is blocking fsockopen?
After struggling for half a day, I finally manage to get reCAPTCHA to work by converting this function:
function _recaptcha_http_post($host, $path, $data, $port = 80) {
$req = _recaptcha_qsencode ($data);
$http_request = "POST $path…

Question Overflow
- 10,925
- 18
- 72
- 110
6
votes
4 answers
connect to a server via sftp php
how do we connect to a remote server via sftp to verify if the login details are valid in php...
i'm using apache server... my use is to check whether the login details entered by user is correct or not.

Akhil K Nambiar
- 3,835
- 13
- 47
- 85
6
votes
1 answer
fsockopen() how does it actually work?
I am trying to develop a code judge software in PHP for programming assignments.
I would try o compile codes on a java server which would require socket programming.I have litle knowledge of socket programming in PHP.
I googled and found a code…

shiven
- 421
- 2
- 8
- 19
5
votes
3 answers
fsockopen connection does not close until timeout
Background:
I have to create a plain site that accepts incoming posted XML and sends the XML to a server via a socket connection and in turn display the XML sent back from the server. Easy peasy.
Problem:
I had no problem utilising fsockopen() to…

vandiedakaf
- 514
- 1
- 6
- 18
5
votes
2 answers
How to fake a resourse for a unit test in PHP?
I had a method, that opened a socket connection, used, and then closed it. In order to make it testable, I moved the dealing with the connection to separate methods (see the code below).
Now I want to write a unit test for the barIntrefaceMethod()…

automatix
- 14,018
- 26
- 105
- 230
5
votes
0 answers
How to use imap_open behind proxy?
I don't really know how to ask this question so I'll just ask it as best I can. Is it possible to use a proxy connection to read mail from a pop3 or imap server using PHP's imap_open?
I would prefer to use imap_open since it's so simple to handle…

john
- 1,330
- 3
- 20
- 34
4
votes
1 answer
Using fsockopen to connect to server - connection refused
What I am trying to do is add support for Votifier plugin on my website.
I have forwarded the correct ports for the Minecraft server, tested and confirmed that they are open. Also used Minestatus to confirm that the Votifier plugin is working…

SlickTheNick
- 91
- 2
- 7
4
votes
1 answer
I need to go through a proxy, (from a running fsockopen code that gets the size from a remote video file)
I've a PHP running code that ask the file size of a remote mp4 file, thanks to a fsockopen function and HEAD command.
Now, i need to move this code to other server behind a proxy, which is the best approach to go through that new proxy, and continue…

Fabrefumi
- 41
- 1
- 4
4
votes
3 answers
Trying to connect SSL server using fsockopen()
I'm running the next script from my local host and the production server, and Im getting different outputs. Anyone knows why am I getting that false from my localhost?

tirenweb
- 30,963
- 73
- 183
- 303
4
votes
1 answer
SMTP protocol to send mail is not working with codeigniter
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'smtp.gmail.com',
'smtp_port' => 465,
'smtp_user' => 'XXXX@XXXX.com',
'smtp_pass' => 'XXXX',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email',…

Shaleen Jain
- 177
- 1
- 11
4
votes
1 answer
How to fix php.DEBUG: fsockopen() :Connection refused?
I want to use server of symfony,to close my apache2 at first.
service apache2 stop
My command history in symfony:
symfony new myblog lts
cd /home/debian8/myblog
php app/console server:run -vvv
[2016-03-19 15:14:11] php.DEBUG: fsockopen(): unable…

showkey
- 482
- 42
- 140
- 295
4
votes
1 answer
CURL vs fsockopen chunking
This may seem kind of weird.. but I need to evaluate/parse chunks being sent over HTTP with PHP.
It's of note to say that the HTTP stream may never end. Is there any way I can parse chunks as I get them with CURL?
Or do I have to resort to some…

David Titarenco
- 32,662
- 13
- 66
- 111
4
votes
2 answers
Writing multiple post requests using single connection - PHP
I am writing to a server using the following snippet.
$fp = connect();
$sent_requests = 0;
function connect() {
$addr = gethostbyname("example.com");
$fp = fsockopen("$addr", 80, $errno, $errstr);
socket_set_blocking( $fp, false );
…

Sohaib
- 4,556
- 8
- 40
- 68
4
votes
1 answer
PHP fsockopen 400 Bad Request
I have this strange problem that I'm receiving 400 Bad request as a response and I have absolutely no idea what's wrong with the header. Here's my code:

Jason
- 113
- 1
- 4
- 12
4
votes
3 answers
fsockopen returning server error(0)
I'm checking fsockopen in Ubuntu server 13.04 with this code:
\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .=…

sukorenomw
- 68
- 1
- 7