首页 >php教程 >PHP源码 >curl调用如java开发的restful接口

curl调用如java开发的restful接口

PHP中文网
PHP中文网原创
2016-05-25 17:10:561496浏览

php代码

<?php
/*
 * 调用例子
 */

define( &#39;SYSPATH&#39;, &#39;./base/http/&#39; );
define( &#39;APIPATH&#39;, &#39;./com/api/&#39; );

require_once SYSPATH.&#39;client.php&#39;;
require_once SYSPATH.&#39;response.php&#39;;
require_once SYSPATH.&#39;client/curl.php&#39;;

require_once APIPATH.&#39;connector.php&#39;;
require_once APIPATH.&#39;response.php&#39;;
require_once APIPATH.&#39;app/query.php&#39;;

$result = Com_Api_App_Query::get( array( &#39;test&#39; => &#39;Hello world&#39; ) );

if ( FALSE === $result )
{
    echo Com_Api_Response::getError();exit;
}

var_dump( $result );

echo &#39;<br><br>&#39;;

$result = Com_Api_App_Query::get( array( &#39;test&#39; => &#39;Hello world&#39; ) );

if ( FALSE === $result )
{
    echo Com_Api_Response::getError();exit;
}

var_dump( $result );
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn