2012-05-29 57 views
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沒有返回任何值!回聲值和存儲爲變量

+0

'var_dump'總是相呼應的東西,即使它是空字符串... –

回答

2

爲什麼你就不能使用:

$variable = '<p>Editorial review: '.html_entity_decode($editorialReview).'</p>'."\n"; 
echo $variable; 
+0

哈哈,是的,可以做的一樣好 –