Bug #1667: fsockopen still doesn't seem to work
| From: | joop dot vriend at ddnh dot nl | Date: | Tue, 06 Jul 1999 08:10:35 +0000 |
| Subject: | Bug #1667: fsockopen still doesn't seem to work | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-8115@lists.php.net to get a copy of this message | ||
From: joop.vriend@ddnh.nl
Operating system: Linux 2.1
PHP version: 3.0.11
PHP Bug Type: Misbehaving function
Bug description: fsockopen still doesn't seem to work
The fsockopen function still doesn't seem to work for us in version 3.0.11, although code we
downloaded from the CVS tree just after version 3.0.8 did the job OK.
This is a piece of code we use for sending mail. When we try to execute it, it just stalls forever.
$FM_fp = fsockopen($FM_mailserver, 25);
if ($FM_fp) {
$FM_s = 0;
$FM_c = 0;
$FM_out = "";
set_socket_blocking($FM_fp, false);
do {
$out = fgets($FM_fp, 2500);
if (ereg( "^220", $out)) {
$FM_s = 0;
$FM_out = "";
$FM_c++;
} else if (( $FM_c > 0 ) && ( $FM_out == "" )){
break;
} else {
$FM_s++;
}
if ($FM_s == 9999) break;
} while ($FM_out == "");
set_socket_blocking($FM_fp, true);
fputs ($FM_fp, "HELO ddnh.nl\n");
$FM_output = fgets($FM_fp, 2000);
fputs ($FM_fp, "MAIL FROM: <sender>\n");
$FM_output = fgets($FM_fp, 2000);
fputs ($FM_fp, "RCPT TO: <$to_email>\n");
$FM_output = fgets($FM_fp, 2000);
if (!ereg("^250", $FM_output)) {
fputs ($FM_fp, "QUIT\n");
fclose($FM_fp);
Error(5, $mailto);
}
fputs ($FM_fp, "DATA\n");
$FM_output = fgets($FM_fp, 2000);
/** Mail headers **/
fputs ($FM_fp, "Subject: $titel\n");
fputs ($FM_fp, "From: $from_name <$from_email>\n");
fputs ($FM_fp, "Reply-To: $to_email\n");
fputs ($FM_fp, "To: $to_email\n");
fputs ($FM_fp, "\n");
/** Message **/
fputs ($FM_fp, "...message...\n");
fputs ($FM_fp, ".\n");
$FM_output = fgets($FM_fp, 2000);
fputs ($FM_fp, "QUIT\n");
fclose($FM_fp);
}
This is our configure line:
./configure --with-apache=/usr/src/apache --with-gd=/usr/src/gd
--with-oracle=/u01/app/oracle/product/8.0.5 --with-pgsql
--with-config-file-path=/usr/local/apache/conf --enable-debug=no --enable-track-vars=yes
--enable-magic-quotes=yes
I hope this is of any use for you and that the problem will be solved quickly.
Joop Vriend.