我通过 file_get_contents 函数来做到这一点:
$html_string = file_get_contents('http://the url I want to import/');
$date = date('Y_m_d H:i');
$name=$_POST["newsletter"] . $date;
$subject=$_POST["subject"];
$segment=$_POST["segment"];
$result = httpPost("https://mautic url/api/emails/new",$html_string,$name,$subject,$segment);
function httpPost($url,$params,$name,$subject,$segment)
{
$header = array(
"Authorization: Basic encoded username and password"
);
$postData = array( 'name' => $name, 'subject' => $subject, 'customHtml' => $params ,'emailType'=>'list', 'lists'=> [$segment] );
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HEADER, true);
curl_setopt($ch,CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, count($postData));
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
$output=curl_exec($ch);
curl_close($ch);
return $output;
}