我创建了一个WordPress插件,激活后在jquery Datatable中显示结果。我们正在通过CURL Post获取结果。帖子URL是ASP。Net应用程序。
该插件是为在帖子中添加我的短代码后遇到以下错误的客户创建的。
客户端使用的是优雅主题的Divi(最新版本),WordPress 5.2.2运行在Apache/PHP 7.2.21上
此错误仅显示在添加了快捷码的帖子页面上:
警告:mysqli\\u query():MySQL服务器已消失在/homepages/10/d241347454/htdocs/wp includes/wp db中。php在线2007**
警告:mysqli\\u query():在/homepages/10/d241347454/htdocs/wp includes/wp db中读取结果集标题时出错。php在线2007**
以下是我的插件代码:
$atts = shortcode_atts(
array(
\'secretkey\' => \'\'
),
$atts,
\'MySecretKeyCaption\'
);
$thisoptions = get_option( \'MySecretKeySettings\' );
$url = \'https://sub.someASPnetWebsite.com/api/TestimonialList\';
$webApiUn = $thisoptions[\'webApiUn\'];
$webApiPwd = $thisoptions[\'webApiPwd\'];
$webApisecretkey = $atts[\'secretkey\'];
$data = array(\'webApiUn\' => $webApiUn, \'webApiPwd\' => $webApiPwd, \'SecretKey\' => $webApisecretkey);
$data_string = json_encode($data);
$ch = curl_init($url);
//curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
\'Content-Type: application/json\',
\'Content-Length: \' . strlen($data_string))
);
curl_setopt($ch, CURLOPT_TIMEOUT,75);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
//execute post
$result = curl_exec($ch);
$endresult = json_decode($result);
foreach ($endresult->reviews->review as $key=>$value) {?>
<tr>
<td><?php echo time_elapsed_string($endresult->reviews->review[$key]->datePublished); ?></td>
<td> <?php echo $endresult->reviews->review[$key]->rating; ?></td>
<td>More Data....</td>
</tr>
<?php } ?>
我无法复制客户报告的错误。在我这边,一切都很顺利。
请指导我如何解决此问题。