我使用curl向URL发送帖子请求,当我尝试删除html字符时,它会继续在我的网页上显示格式化的html,理想情况下我不希望它显示任何内容但是让它显示未格式化的HTML比格式化的html更好,关于我哪里出错的任何想法?
<?php
$url = 'https://example.com/';
$fields = array(
'postParam' => 'xxxxxx'
);
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
$result = htmlspecialchars(curl_exec($ch));
curl_close($ch);
//do something with the result
?>