【发布时间】:2011-11-18 02:23:09
【问题描述】:
我们想从 iPhone 调用一个 restful post API。你能给我一个示例代码sn-p吗?
我的 API URL 是 http://machinename/asyh/restful.php/1/VideoStreaming post参数名称为file_chunk。
API 会将在 file_chunk 参数中接收到的数据附加到服务器中的文件中。
我从 C# 调用了相同的 API。但我不知道如何从 iOS 调用它。请帮帮我。
下面给出了服务器代码(在 PHP 中)。 RESTful Web 服务是使用 PHP 使用 synfony 框架编写的。
$fileChunk = $request->getPostParameter('filechunk');
$vodFolder = 'D:\\web\\entertainment\\';
$vodFile = $vodFolder . "testFile.mov";
$fh = fopen($vodFile, 'a');
fwrite($fh, $fileChunk);
fclose($fh);
【问题讨论】: