#40151 [Bgs-Opn]: fsockopen can not work?

2007-01-21 Thread playercd8 at hotmail dot com
 ID:   40151
 User updated by:  playercd8 at hotmail dot com
 Reported By:  playercd8 at hotmail dot com
-Status:   Bogus
+Status:   Open
 Bug Type: Network related
 Operating System: FreeBSD5.5
 PHP Version:  5.2.0
 New Comment:

Because, is PHP Version too new ?

use 
?php
phpinfo();
?

-
OS = FreeBSD 5.5
PHP Version 5.2.0

Configure Command=
'./configure' '--enable-versioning' '--enable-memory-limit'
'--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php'
'--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local'
'--enable-reflection' '--enable-spl' '--program-prefix='
'--enable-fastcgi' '--with-apxs2=/usr/local/sbin/apxs'
'--with-regex=php' '--with-zend-vm=CALL' '--prefix=/usr/local'

PHP API = 20041225
PHP Extension   = 20060613
Zend Extension  = 220060519 

but, Sockets Support =  enabled ? why?

---
OS = Fedora Core 6
PHP Version 5.1.6

Configure Command =
'./configure' '--build=i386-redhat-linux' '--host=i386-redhat-linux'
'--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr'
'--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin'
'--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include'
'--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var'
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--cache-file=../config.cache'
'--with-libdir=lib' '--with-config-file-path=/etc'
'--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic'
'--disable-rpath' '--without-pear' '--with-bz2' '--with-curl'
'--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr'
'--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm'
'--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr'
'--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr'
'--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU'
'--enable-exif' '--enable-ftp' '--enable-magic-quotes'
'--enable-sockets' '--enable-sysvsem' '--enable-sysvshm'
'--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid'
'--enable-yp' '--enable-wddx' '--with-kerberos'
'--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr'
'--enable-memory-limit' '--enable-shmop' '--enable-calendar'
'--enable-dbx' '--enable-dio' '--with-mime-magic=/etc/httpd/conf/magic'
'--without-sqlite' '--with-libxml-dir=/usr' '--with-xml'
'--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd'
'--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC'
'--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter'

PHP API = 20041225
PHP Extension   = 20050922
Zend Extension  = 220051025

Sockets Support = enabled


Previous Comments:


[2007-01-19 09:39:02] playercd8 at hotmail dot com

are your answer like PHP5 can not sure to use fsockopen at FreeBSD?

is fsockopen not support at FreeBSD, now?

or, you are remove PHP5 able use at FreeBSD?

It's Bug? or not bug?



[2007-01-19 08:07:53] [EMAIL PROTECTED]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.





[2007-01-19 04:25:18] playercd8 at hotmail dot com

I can manual telnet remote WebServer to get a html-file at FreeBSD.

but, I can not use fsockopen at FreeBSD.

Why?



[2007-01-19 02:23:15] playercd8 at hotmail dot com

function HttpRequest, It can run at PHP of Fedora Core 6.
but, Why it can not run at FreeBSD ?

Source code of the function, from 
http://www.webdeveloper.com/forum/archive/index.php/t-117095.html
, and my some fix it.



PHP work at FreeBSD, It can use socket_connect/socket_recv/socket_write
...etc.
but, why It can not use fsockopen ?

Why ?
-

function HttpRequest( $url, $method = GET, $data = NULL,
$additional_headers = NULL, $followRedirects = true )

{

# in compliance with the RFC 2616 post data will not redirected

$method = strtoupper($method);

$url_parsed = @parse_url($url);

if ([EMAIL PROTECTED]'scheme']) $url_parsed =
@parse_url('http://'.$url);

extract($url_parsed);



$data_get = NULL;

if(is_array($data))

{

$ampersand = '';

$temp = NULL

#40151 [Bgs]: fsockopen can not work?

2007-01-19 Thread playercd8 at hotmail dot com
 ID:   40151
 User updated by:  playercd8 at hotmail dot com
 Reported By:  playercd8 at hotmail dot com
 Status:   Bogus
 Bug Type: Network related
 Operating System: FreeBSD5.5
 PHP Version:  5.2.0
 New Comment:

are your answer like PHP5 can not sure to use fsockopen at FreeBSD?

is fsockopen not support at FreeBSD, now?

or, you are remove PHP5 able use at FreeBSD?

It's Bug? or not bug?


Previous Comments:


[2007-01-19 08:07:53] [EMAIL PROTECTED]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.





[2007-01-19 04:25:18] playercd8 at hotmail dot com

I can manual telnet remote WebServer to get a html-file at FreeBSD.

but, I can not use fsockopen at FreeBSD.

Why?



[2007-01-19 02:23:15] playercd8 at hotmail dot com

function HttpRequest, It can run at PHP of Fedora Core 6.
but, Why it can not run at FreeBSD ?

Source code of the function, from 
http://www.webdeveloper.com/forum/archive/index.php/t-117095.html
, and my some fix it.



PHP work at FreeBSD, It can use socket_connect/socket_recv/socket_write
...etc.
but, why It can not use fsockopen ?

Why ?
-

function HttpRequest( $url, $method = GET, $data = NULL,
$additional_headers = NULL, $followRedirects = true )

{

# in compliance with the RFC 2616 post data will not redirected

$method = strtoupper($method);

$url_parsed = @parse_url($url);

if ([EMAIL PROTECTED]'scheme']) $url_parsed =
@parse_url('http://'.$url);

extract($url_parsed);



$data_get = NULL;

if(is_array($data))

{

$ampersand = '';

$temp = NULL;

foreach($data as $k = $v)

{

if ($k != 0)

{

$temp .= 
$ampersand.urlencode($k).'='.urlencode($v);

$ampersand = '';

}

}

$data_get = $temp;

}

if([EMAIL PROTECTED])

{

if ($scheme == https)

$port = 443;

else

$port = 80;

}

if([EMAIL PROTECTED]) $path = '/';

if(($method == GET) and (@$data_get)) $path .= ?.$data_get;


#debug  
if ($this-debug == true)   echo $path; 


$out = $method $path {$_SERVER['SERVER_PROTOCOL']}\r\n;

$out .= Host: $host\r\n;


if($method == 'POST')

{

$out .= Content-type: 
application/x-www-form-urlencoded\r\n;

$out .= Content-length:  . @strlen($data_get) . 
\r\n;

}

$out .= (@$additional_headers)?$additional_headers:'';

$out .= Connection: Close\r\n\r\n;

if($method == POST) $out .= $data_get.\r\n;

#debug
if ($this-debug == true)   echo $out;

#fix https

$openhost = ($scheme == https ? ssl:// : ).$host;

#debug

if ($this-debug == true)   echo
OpenSocket:.$openhost.(.$port.);


if(!$fp = @fsockopen($openhost, $port, $errno, $errstr, 15))

{
#debug

if ($this-debug == true)   echo Now can not open
socket.\nError($errno) $errstr\n;


return false;

}

fwrite($fp, $out);



while (!feof($fp))

{

$s = fgets($fp, 128);


#debug

if ($this-debug == true)   echo \n.$s;



if ( $s == \r\n )

{

$foundBody = true;

continue;

}

if ( $foundBody )

{

$body .= $s

#40151 [Fbk-Opn]: fsockopen can not work?

2007-01-18 Thread playercd8 at hotmail dot com
 ID:   40151
 User updated by:  playercd8 at hotmail dot com
 Reported By:  playercd8 at hotmail dot com
-Status:   Feedback
+Status:   Open
 Bug Type: Network related
 Operating System: FreeBSD5.5
 PHP Version:  5.2.0
 New Comment:

function HttpRequest, It can run at PHP of Fedora Core 6.
but, Why it can not run at FreeBSD ?

Source code of the function, from 
http://www.webdeveloper.com/forum/archive/index.php/t-117095.html
, and my some fix it.



PHP work at FreeBSD, It can use socket_connect/socket_recv/socket_write
...etc.
but, why It can not use fsockopen ?

Why ?
-

function HttpRequest( $url, $method = GET, $data = NULL,
$additional_headers = NULL, $followRedirects = true )

{

# in compliance with the RFC 2616 post data will not redirected

$method = strtoupper($method);

$url_parsed = @parse_url($url);

if ([EMAIL PROTECTED]'scheme']) $url_parsed =
@parse_url('http://'.$url);

extract($url_parsed);



$data_get = NULL;

if(is_array($data))

{

$ampersand = '';

$temp = NULL;

foreach($data as $k = $v)

{

if ($k != 0)

{

$temp .= 
$ampersand.urlencode($k).'='.urlencode($v);

$ampersand = '';

}

}

$data_get = $temp;

}

if([EMAIL PROTECTED])

{

if ($scheme == https)

$port = 443;

else

$port = 80;

}

if([EMAIL PROTECTED]) $path = '/';

if(($method == GET) and (@$data_get)) $path .= ?.$data_get;


#debug  
if ($this-debug == true)   echo $path; 


$out = $method $path {$_SERVER['SERVER_PROTOCOL']}\r\n;

$out .= Host: $host\r\n;


if($method == 'POST')

{

$out .= Content-type: 
application/x-www-form-urlencoded\r\n;

$out .= Content-length:  . @strlen($data_get) . 
\r\n;

}

$out .= (@$additional_headers)?$additional_headers:'';

$out .= Connection: Close\r\n\r\n;

if($method == POST) $out .= $data_get.\r\n;

#debug
if ($this-debug == true)   echo $out;

#fix https

$openhost = ($scheme == https ? ssl:// : ).$host;

#debug

if ($this-debug == true)   echo
OpenSocket:.$openhost.(.$port.);


if(!$fp = @fsockopen($openhost, $port, $errno, $errstr, 15))

{
#debug

if ($this-debug == true)   echo Now can not open
socket.\nError($errno) $errstr\n;


return false;

}

fwrite($fp, $out);



while (!feof($fp))

{

$s = fgets($fp, 128);


#debug

if ($this-debug == true)   echo \n.$s;



if ( $s == \r\n )

{

$foundBody = true;

continue;

}

if ( $foundBody )

{

$body .= $s;

} else {



#echo $s;



if( ($followRedirects) and 
(preg_match('/^Location:(.*)/i', $s,
$matches) != false) )

{

fclose($fp);

if (strpos(trim($matches[1]), 'http') 
=== false)

{

$urlTo = trim($matches[1]);

$urlLocation = ($scheme == 
'https' ? 'https://' :
'http://').($host).(substr($urlTo, 0, 1) == '/' ? '' : '/').($urlTo);

return $this-HttpRequest( 
$urlLocation );

}

else

return $this-HttpRequest( 
trim($matches[1]) );

}

$header .= $s;


if(preg_match('@HTTP[/]1

#40151 [Opn]: fsockopen can not work?

2007-01-18 Thread playercd8 at hotmail dot com
 ID:   40151
 User updated by:  playercd8 at hotmail dot com
 Reported By:  playercd8 at hotmail dot com
 Status:   Open
 Bug Type: Network related
 Operating System: FreeBSD5.5
 PHP Version:  5.2.0
 New Comment:

I can manual telnet remote WebServer to get a html-file at FreeBSD.

but, I can not use fsockopen at FreeBSD.

Why?


Previous Comments:


[2007-01-19 02:23:15] playercd8 at hotmail dot com

function HttpRequest, It can run at PHP of Fedora Core 6.
but, Why it can not run at FreeBSD ?

Source code of the function, from 
http://www.webdeveloper.com/forum/archive/index.php/t-117095.html
, and my some fix it.



PHP work at FreeBSD, It can use socket_connect/socket_recv/socket_write
...etc.
but, why It can not use fsockopen ?

Why ?
-

function HttpRequest( $url, $method = GET, $data = NULL,
$additional_headers = NULL, $followRedirects = true )

{

# in compliance with the RFC 2616 post data will not redirected

$method = strtoupper($method);

$url_parsed = @parse_url($url);

if ([EMAIL PROTECTED]'scheme']) $url_parsed =
@parse_url('http://'.$url);

extract($url_parsed);



$data_get = NULL;

if(is_array($data))

{

$ampersand = '';

$temp = NULL;

foreach($data as $k = $v)

{

if ($k != 0)

{

$temp .= 
$ampersand.urlencode($k).'='.urlencode($v);

$ampersand = '';

}

}

$data_get = $temp;

}

if([EMAIL PROTECTED])

{

if ($scheme == https)

$port = 443;

else

$port = 80;

}

if([EMAIL PROTECTED]) $path = '/';

if(($method == GET) and (@$data_get)) $path .= ?.$data_get;


#debug  
if ($this-debug == true)   echo $path; 


$out = $method $path {$_SERVER['SERVER_PROTOCOL']}\r\n;

$out .= Host: $host\r\n;


if($method == 'POST')

{

$out .= Content-type: 
application/x-www-form-urlencoded\r\n;

$out .= Content-length:  . @strlen($data_get) . 
\r\n;

}

$out .= (@$additional_headers)?$additional_headers:'';

$out .= Connection: Close\r\n\r\n;

if($method == POST) $out .= $data_get.\r\n;

#debug
if ($this-debug == true)   echo $out;

#fix https

$openhost = ($scheme == https ? ssl:// : ).$host;

#debug

if ($this-debug == true)   echo
OpenSocket:.$openhost.(.$port.);


if(!$fp = @fsockopen($openhost, $port, $errno, $errstr, 15))

{
#debug

if ($this-debug == true)   echo Now can not open
socket.\nError($errno) $errstr\n;


return false;

}

fwrite($fp, $out);



while (!feof($fp))

{

$s = fgets($fp, 128);


#debug

if ($this-debug == true)   echo \n.$s;



if ( $s == \r\n )

{

$foundBody = true;

continue;

}

if ( $foundBody )

{

$body .= $s;

} else {



#echo $s;



if( ($followRedirects) and 
(preg_match('/^Location:(.*)/i', $s,
$matches) != false) )

{

fclose($fp);

if (strpos(trim($matches[1]), 'http') 
=== false)

{

$urlTo = trim($matches[1]);

$urlLocation = ($scheme == 
'https' ? 'https://' :
'http://').($host).(substr($urlTo, 0, 1) == '/' ? '' : '/').($urlTo);

return $this-HttpRequest( 
$urlLocation );

}

else

#40151 [NEW]: fsockopen can not work?

2007-01-17 Thread playercd8 at hotmail dot com
From: playercd8 at hotmail dot com
Operating system: FreeBSD5.5
PHP version:  5.2.0
PHP Bug Type: Network related
Bug description:  fsockopen can not work?

Description:

$errno is return 671845376
$errstr is not retuen any string
Why I can not use fsockopen to work ?

Reproduce code:
---
if(!$fp = @fsockopen($openhost, $port, $errno, $errstr, 15))

{
#debug

if ($this-debug == true)   echo Now can not open 
socket.\nError($errno)
$errstr\n;


return false;

}

Expected result:

..


-- 
Edit bug report at http://bugs.php.net/?id=40151edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40151r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40151r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40151r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40151r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=40151r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=40151r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=40151r=needscript
Try newer version:http://bugs.php.net/fix.php?id=40151r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=40151r=support
Expected behavior:http://bugs.php.net/fix.php?id=40151r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=40151r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=40151r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40151r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40151r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40151r=dst
IIS Stability:http://bugs.php.net/fix.php?id=40151r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=40151r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40151r=float
No Zend Extensions:   http://bugs.php.net/fix.php?id=40151r=nozend
MySQL Configuration Error:http://bugs.php.net/fix.php?id=40151r=mysqlcfg