我正在尝试使用REST API登录SuiteCRM。使用演示SuiteCRM rest API文档中显示的相同代码。代码在localhost上运行正常。但是当我把文件放在服务器上时。它显示一个空白屏幕。
<?php
$url = "http://example.com/suitecrm/service/v4_1/rest.php";
function restRequest($method, $arguments){
global $url;
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$post = array(
"method" => $method,
"input_type" => "JSON",
"response_type" => "JSON",
"rest_data" => json_encode($arguments),
);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
$result = curl_exec($curl);
curl_close($curl);
return json_decode($result,1);
}
$userAuth = array(
'user_name' => 'username',
'password' => md5('password'),
);
$appName = 'My SuiteCRM REST Client';
$nameValueList = array();
$args = array(
'user_auth' => $userAuth,
'application_name' => $appName,
'name_value_list' => $nameValueList);
$result = restRequest('login',$args);
$sessId = $result['id'];
echo $sessId;
当我使用demo.suiteondemand.com的链接并传递其用户名和密码时,相同的代码正在运行。
可能是http
和https
的问题吗?