<html>
<body>
<?php
function HTTP_Post($URL,$cookie)
{
// parsing the given URL
$URL_Info=parse_url($URL);
var_dump($URL_Info);
// Building referrer
$referrer="111";
// making string from $data
//foreach($data as $key=>$value)
//$values[]="$key=".urlencode($value);
$file="I:/1/1.wav";
$data_string = file_get_contents($file);
//$data_string="kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk";
// Find out which port is needed - if not given use standard (=80)
if(!isset($URL_Info["port"]))
$URL_Info["port"]=80;
$request1="Content-Disposition: form-data;";
$request1.="name=\"test.name\";";
$request1.="opcode=\"transcribe_audio\";";
$request1.="sessionid=\"1\";";
$request1.="tmp_entry_id=\"2222222222222222222\";";
$request1.="filename=\"sssssssss\";";
$request1.="type=\"0\";";
$request1.="time=\"11111111111\";";
$request1.="reqid=\"12345\";";
$request1.="latitude=\"1\";";
$request1.="location=\"1\";";
$request1.="language=\"chinese\";"; // use ThinkIT engine
$request1.="uId=\"1\";";
$request1.="ver=\"1.1-123\";";
$request1.="kId=\"46\";";
$request1.="aId=\"2\";";
$request1.="grammarname=\"city\";";
$request1.="sr=\"11\";\r\n";
$boundary = "----------V2ymHFg03ehbqgZCaKO6jy";
// building POST-request:
$request="POST ".$URL_Info["path"]." HTTP/1.1\r\n";
$request.="Host: ".$URL_Info["host"]."\r\n";
$request.="Referer: $referrer\r\n";
$request.="Content-type: multipart/form-data;boundary=".$boundary."\r\n";
$data="--".$boundary."\r\n";
$data.=$request1;
$data.="\r\n";
$data.=$data_string."\r\n";
$data.="--".$boundary."--\r\n";
$request.="Content-length: ".strlen($data)."\r\n";
$request.="Connection: close\r\n\r\n";
$request.=$data;
echo $request;
$fp = fsockopen($URL_Info["host"],$URL_Info["port"]);
fputs($fp, $request);
$result="";
while(!feof($fp)) {
$result .= fgets($fp, 1024);
}
echo "\r\nsssssss------------".iconv("UTF-8", "GB2312", "$result");
fclose($fp);
return $result;
}
HTTP_Post("http://localhost:8080:/test/up","1");
?>
</body>
</html>
分享到:
相关推荐
php post例子...........................
js php 通过post方法,实现对数据库的操作,有兴趣的可以下载看一下
PHP封装cUrl库,实现post登录,get请求资源。支持cookie。 内附使用方法,公司打卡的小案例。
想使用POST工具。网上下载的试了几个都不太好用。 于是做一个PHP版的。 自已用的放到PHP环境下。 使用上不方便的可以与我交流
PHP初学者头疼问题总结:页面之间无法传递变量 get,post,session在最新的php版本中自动全局变量是关闭的,所以要从上一页面取得提交过来得变量要使用$_GET[ foo ],$_POST[ foo ],$_SESSION[ foo ]来得到
NULL 博文链接:https://onestopweb.iteye.com/blog/2380817
JS+PHP的一个后台发送POST请求的源码.一个比较好的例子,希望对年轻人有点帮助.
今天小编就为大家分享一篇php post json参数的传递和接收处理方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
VC利用POST方法提交请求,并附有PHP服务端源码
PHP POST数据的三种方法 php有三种方法可以post数据,分别为Curl、socket、file_get_contents:
相关函数为rfc1867_post_handler,如果超过长度,则不会调用safe_php_register_variable来进行变量注册 相关堆栈如下 复制代码 代码如下: #0 rfc1867_post_handler ( content_type_dup=0x7ff85307a5f8 “mu
post_phppost_phppost_phppost_phppost_phppost_phppost_phppost_php
PHP通用短信接口发送(post形式),只要替换你的URL,改参数名就可以使用了
新手学习PHP接口,使用案例,PHP动态接口通过POST,传输JSON至后端PHP文件,并接收处理。 压缩包内有2个PHP文件。 前端PHP文件,发送,写明如何使用json_encode()传输数组 后台PHP文件,接收接口,详细写明如何接收...
PHP版SOCKET模拟提交POST消息 模拟邮箱登陆什么的就可以做了。
php class Request{ public static function post($url, $post_data = '', $timeout = 5){//curl $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_POST...
php的socket发送post请求示例
php网站开发用户登录/注册使用post方法访问mysql数据库,包括登录、注册。其实原理都是一样的,希望对大家有用,如果有问题,可以联系我
使用 ======================== - SELECT *FROM myArray ORDER BY key DESC,value ASC, - SELECT key,value FROM myArray WHERE value= 100...- INSERT INTO myArray.subitems ( known_langs ) VALUES ( PHP,C#,C++ )
PHP调用接口用post方法传送json数据的实例 PHP调用接口用post方法传送json数据的实例