Home  >  Article  >  Backend Development  >  fsockopen顺利后,fwrite失败

fsockopen顺利后,fwrite失败

WBOY
WBOYOriginal
2016-06-13 10:35:061043browse

fsockopen成功后,fwrite失败

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$out = "POST $path HTTP/1.0\r\n";        $out .= "Accept: */*\r\n";        $out .= "Accept-Language: zh-cn\r\n";        $out .= "Content-Type: application/x-www-form-urlencoded\r\n";        $out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n";        $out .= "Host: $host\r\n";        $out .= "Content-Length: ".strlen($post)."\r\n";        $out .= "Connection: Close\r\n";        $out .= "Cache-Control: no-cache\r\n";        $out .= "Cookie: $cookie\r\n\r\n";        $out .= $post;if(!$fp) {        return '';//note $errstr : $errno \r\n    } else {        stream_set_blocking($fp, $block);        stream_set_timeout($fp, $timeout);//程序已经跑到这里,但接受POST的文件没执行到。。        @fwrite($fp, $out);@fclose($fp);}


本地测试可以,到了服务器就不行了。。。



------解决方案--------------------
哪里不行? 你提供的信息太少,无法判断。
------解决方案--------------------
怎么会这样呢,先看看权限吧,是不是只读的?
------解决方案--------------------
$fp fsockopen 语句没有看到,把完整代码贴一下。

------解决方案--------------------
应该是服务器没有写的权限。
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn