---
title: "php post"
author: "canofy"
date: "2014-03-28T15:58:05Z"
tags: []
categories: ["编程语言"]
slug: "php-post"
draft: false
lastmod: "2014-06-19T11:35:09Z"
id: 2038010
url: "https://canofy.iteye.com/blog/2038010"
---

\[code="java"] $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"); ?&gt; \[/code]