php 手机下载 POST 类
由于最近在与SP合作,开发手机业务下载,数据提交采用POST方式提交,现与大家分亨比较成熟类.
function uc_api_post($url, $action, $sendmsg='') {
$postdata = "corpMsg=$sendmsg";
return uc_fopen(UC_URL, 500000, $postdata, '', TRUE, UC_IP, 20);
}
function uc_fopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE) {
$return = '';
$matches = parse_url($url);
!isset($matches['host']) && $matches['host'] = '';
!isset($matches['path']) && $matches['path'] = '';
!isset($matches['query']) && $matches['query'] = '';
!isset($matches['port']) && $matches['port'] = '';
$host = $matches['host'];
$path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : '') : '/';
$port = !empty($matches['port']) ? $matches['port'] : 80;
if($post) {
$out = "POST $path HTTP/1.0\r\n";
$out .= "Accept: */*\r\n";
//$out .= "Referer: $boardurl\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;
} else {
$out = "GET $path HTTP/1.0\r\n";
$out .= "Accept: */*\r\n";
//$out .= "Referer: $boardurl\r\n";
$out .= "Accept-Language: zh-cn\r\n";
$out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n";
$out .= "Host: $host\r\n";
$out .= "Connection: Close\r\n";
$out .= "Cookie: $cookie\r\n\r\n";
}
$fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
if(!$fp) {
return '';
} else {
stream_set_blocking($fp, $block);
stream_set_timeout($fp, $timeout);
@fwrite($fp, $out);
$status = stream_get_meta_data($fp);
if(!$status['timed_out']) {
while (!feof($fp)) {
if(($header = @fgets(
相关文档:
http://www.xhsd.com.cn/books/views.asp?plucode=711126281
这本书被称为PHP和MySQL的“圣经”,仔细看了一下,的确有很多独到的地方。
首先,内容明确突出。这本书的目的是对PHP和MySQL做深入浅出的分析,对其Web应用做了较全面的阐述,例子经典实用。
其次,新。PHP5.3,MySQL的存储过程和存储引擎,Ajax技 ......
现在主流的网站开发语言无外乎asp、php、asp.net、jsp等。
网页从开始简单的hmtl到复杂的服务语言,走过了10多个年头,各种技术层出不穷,单个的主流技术也在不断翻新的版本,现在分析下各种语言的区别、优势、劣势、开发注意事项!
HTML:当然这是网页最基本的语言,每一个服务器语言都需要它的支持,要学习,这个肯定是开始 ......
整理一篇比较详细的windows下php运行环境的配置的资料,包括apache的安装、mysql的安装、php的安装、 ZendOptimizer 的安装、phpMyAdmin的安装,包括安装过程会出现的问题的解决,比如:phpMyAdmin数据库中文乱码的解决等。
//****************
1、软件
(1)apache_2.2.4-win32-x86-no_ssl.zip
(2)mysql-5.0.27-win32.zi ......
一、问题起源
稍大一些的网站,通常都会有好几个服务器,每个服务器运行着不同功能的模块,使用不同的二级域名,而一个整体性强的网站,用户系统是统一的,即一套
用户名、密码在整个网站的各个模块中都是可以登录使用的。各个服务器共享用户数据是比较容易实现的,只需要在后端放个数据库服务器,各个服务器通过统一接
......
在PHP中,入栈通过array_push函数实现,语法如下:
int array_push(array,var [,var …])
var为要压入数组的元素,array为数组。函数返回数组新的元素总数。
例如:
<?php
$php = array("php","phpdo","php学习");
print_r($php);
array_push($php, ......