You are here: Re: getting bad results from fsocketopen « PHP Programming Language « IT news, forums, messages
Re: getting bad results from fsocketopen

Posted by lawrence k on 10/16/38 11:47

yawnmoth wrote:
> Try this, instead:
>
> POST /errors/index.htm HTTP/1.1
> Host: www.publicdomainsoftware.org
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 1200
> Connection: close
>
> %3C%2Fdiv%3E
>
> Note how there are two new lines between the last HTTP header and the
> actual data. Also... the Content-Length field doesn't look correct.
> strlen(urldecode('%3C%2Fdiv%3E')) is definitly not 1200...


It's curious, but fsocketopen takes forever. It's basically unuseable
for me. It brings the site to a standstill. My code is taken straight
from an example on www.php.net:



$message = rawurlencode($message);
$message = "&errorInput=$message";
$length = strlen($message);

$fp = fsockopen("www.publicdomainsoftware.org", 80, $errno, $errstr,
30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "POST /errors/errorInput.php HTTP/1.1\r\n";
$out .= "Host: www.publicdomainsoftware.org\r\n";
$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
$out .= "Content-Length: $length\r\n";
$out .= "Connection: Close\r\n\r\n";
$out .= "$message";

fwrite($fp, $out);
while (!feof($fp)) {
// echo fgets($fp, 128);
}
fclose($fp);
}



The variable $message is just the parameter being passed in. This code
can take 4 or 5 minutes to work, and then finally the pages, often,
just time out.

Any idea why that might be?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация