Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,870 questions

51,793 answers

573 users

How to use fsockopen() function to open or unix domain socket connection in PHP

1 Answer

0 votes
$fs = fsockopen("www.collectivesolver.com", 80, $errno, $errstr, 30);
    
if (!$fs) 
    echo "$errstr ($errno) <br />";
else
{
    $s = "GET / HTTP/1.1\r\n";
    $s .= "Host: www.collectivesolver.com\r\n";
    $s .= "Connection: Close\r\n\r\n";
       
    fwrite($fs, $s);
       
    while (!feof($fs)) 
         echo fgets($fs, 128);
       
    fclose($fs);
}
    
/*
run: 

HTTP/1.1 200 OK X-Powered-By: PHP/5.4.45 Set-Cookie: PHPSESSID=mdf192cou...

*/

 



answered May 7, 2016 by avibootz
edited May 12, 2016 by avibootz

Related questions

1 answer 198 views
1 answer 164 views
164 views asked Oct 7, 2016 by avibootz
1 answer 435 views
4 answers 281 views
...