0
$ch = curl_init();                   //this part we set up curl 
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$xml_response = curl_exec($ch);
curl_close($ch);
header('Content-type: application/xml');  //specify as xml to not display as one long string
echo $xml_response; 
//header('Content-type: text/plain');  //specify as xml to not display as one long string
$xml = new SimpleXMLElement($xml_response);  //time to echo back the correct piece of data

$editorialReview = $xml->Items->Item->EditorialReviews->EditorialReview->Content;
ob_start();
echo '<p>Editorial review: '.html_entity_decode($editorialReview).'</p>'."\n"; 
$MineNow = ob_get_contents();
ob_end_clean();
var_dump($MineNow);

我想要做的是在回声之后我需要将它存储到一个变量中,这样我就可以将数据发布到 mysql 中;我尝试使用 ob_start 会话来捕获它,但 var_dump 没有返回任何值!

4

1 回答 1

2

为什么你不能只使用:

$variable = '<p>Editorial review: '.html_entity_decode($editorialReview).'</p>'."\n";
echo $variable;
于 2012-05-29T10:18:34.293 回答