I'm new in android, I want to send My Drupal 7 content to Android. I can just send a $Variuable to android in this PHP webservice. How can I do that?
2条回答 默认 最新
- doue8385 2014-07-21 07:05关注
You can use services module for doing this. Also you need to install rest server
After this module is installed you can create your own endpoint in admin->structure->serviecs
You can add new custom rest services via views using services_views or in your custom module.
- Create custom module then write the below code to manually create a REST service.
// services resources function YOURMODULE_services_resources() {
$resources = array( 'ups' => array( 'actions' => array( 'yourservice' => array( 'help' => t('Service details.'), 'callback' => 'your_rest_api_callback_function', 'args' => array(), 'access arguments' => array('access content'), 'access arguments append' => false, 'args' => array( array( 'name' => 'data', 'type' => 'array', 'description' => 'Arguments description.', 'source' => 'data', 'optional' => TRUE, ), ), ), ), ), ); return $resources;
}
function your_rest_api_callback_function($data) { // in $data you will get the passed arguments $returnarr = "this is the content you need to return" return $returnarr; }
Then enable this services form your new api created in admin->structure->services
You can specify the return data format in this module configuration.
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
- ¥15 如何在炒股软件中,爬到我想看的日k线
- ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
- ¥15 seatunnel 怎么配置Elasticsearch
- ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
- ¥15 (标签-MATLAB|关键词-多址)
- ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
- ¥500 52810做蓝牙接受端
- ¥15 基于PLC的三轴机械手程序
- ¥15 多址通信方式的抗噪声性能和系统容量对比