How enable fopen in directadmin?

UserQ

New member
Joined
Oct 28, 2010
Messages
3
Hello!
I have a problem with fsockopen on my DA. Take script in php.net

Code:
<?php
$fp = fsockopen("http://www.wonderabas.com", 80, $errno, $errstr, 30);
if (!$fp) {
    echo "$errstr ($errno)<br />\n";
} else {
    $out = "GET / HTTP/1.1\r\n";
    $out .= "Host: http://www.wonderabas.com\r\n";
    $out .= "Connection: Close\r\n\r\n";
    fwrite($fp, $out);
    while (!feof($fp)) {
        echo fgets($fp, 128);
    }
    fclose($fp);
}
?>

Check it

Warning: fsockopen() [function.fsockopen]: unable to connect to http://www.wonderabas.com:80 (Unable to find the socket transport "http" - did you forget to enable it when you configured PHP?) in /home/admin/domains/domain.com/public_html/2.php on line 2
Unable to find the socket transport "http" - did you forget to enable it when you configured PHP? (-1514634880)

So We need enable on php.ini and apache(in what config?)
cat /usr/local/lib/php.ini | grep fopen
allow_url_fopen = On

I'm on right way? Or maybe something to do wrong?

PS It's my domain added in DA.
PS2 How enable it for all domains?
 
PHP:
<?php
$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
if (!$fp) {
    echo "$errstr ($errno)<br />\n";
} else {
    $out = "GET / HTTP/1.1\r\n";
    $out .= "Host: www.example.com\r\n";
    $out .= "Connection: Close\r\n\r\n";
    fwrite($fp, $out);
    while (!feof($fp)) {
        echo fgets($fp, 128);
    }
    fclose($fp);
}
?>


Note, it has nothing with Directadmin.
 
Back
Top