lua中的socket用易语言如何实现呢?
localhttp=require("socket.http");localresponse_body={}localpost_data='asd';res,code=h...
local http = require("socket.http");
local response_body = {}
local post_data = 'asd';
res, code = http.request{
url = "http://127.0.0.1/post.php",
method = "POST",
headers =
{
["Content-Type"] = "application/x-www-form-urlencoded",
["Content-Length"] = #post_data,
},
source = ltn12.source.string('data=' .. post_data),
sink = ltn12.sink.table(response_body)
}
以上如果在易语言如何实现呢? 展开
local response_body = {}
local post_data = 'asd';
res, code = http.request{
url = "http://127.0.0.1/post.php",
method = "POST",
headers =
{
["Content-Type"] = "application/x-www-form-urlencoded",
["Content-Length"] = #post_data,
},
source = ltn12.source.string('data=' .. post_data),
sink = ltn12.sink.table(response_body)
}
以上如果在易语言如何实现呢? 展开
1个回答
2015-07-24
展开全部
$request = curl_init('IP/test.mp3');
curl_setopt($request, CURLOPT_POST, true);
curl_setopt(
$request,
CURLOPT_POSTFIELDS,
array(
'file' => '@' . realpath('/home/test.mp3')
));
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($request);
// close the session
curl_close($request);
>
curl_setopt($request, CURLOPT_POST, true);
curl_setopt(
$request,
CURLOPT_POSTFIELDS,
array(
'file' => '@' . realpath('/home/test.mp3')
));
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($request);
// close the session
curl_close($request);
>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询