그래서이 민간 기능이 있습니다PHP 컬는 XML 피드는 모든 데이터를 반환하지 않습니다 얻을 수
private function curl_get($url)
{
// Initiate the curl session
$ch = curl_init();
// Set the URL
curl_setopt($ch, CURLOPT_URL, $url);
// Removes the headers from the output
curl_setopt($ch, CURLOPT_HEADER, 0);
// Return the output instead of displaying it directly
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
// Execute the curl session
$output = curl_exec($ch);
// Close the curl session
curl_close($ch);
return $output;
}
을 그리고이 링크 예를 들어 만약 내가 사용 http://www.metacafe.com/api/item/cb-xuFyGC0jJqPfhMoFnewj4Da_ZhHCz4L2/이
지금 문제가 아무튼이다
[data] => SimpleXMLElement Object
(
[@attributes] => Array
(
[version] => 2.0
[source] => Metacafe
)
[title] => Metacafe
[channel] => SimpleXMLElement Object
(
[title] => SimpleXMLElement Object
(
)
[link] => http://www.metacafe.com/watch/cb-GKeDVFevZxk_rNri_uz_K01azz3uV_ZZ/
[image] => SimpleXMLElement Object
(
[url] => http://s.mcstatic.com/Images/MCLogo4RSS.jpg
[link] => http://www.metacafe.com
[title] => Metacafe
[height] => 65
[width] => 229
)
[description] => SimpleXMLElement Object
(
)
[item] => SimpleXMLElement Object
(
[id] => cb-GKeDVFevZxk_rNri_uz_K01azz3uV_ZZ
[author] => CBS
[title] => Romney Concedes South Carolina Primary
[link] => http://www.metacafe.com/watch/cb-GKeDVFevZxk_rNri_uz_K01azz3uV_ZZ/romney_concedes_south_carolina_primary/
[rank] => 4.00
[category] => News & Events
[description] => SimpleXMLElement Object
(
)
[guid] => http://www.metacafe.com/watch/cb-GKeDVFevZxk_rNri_uz_K01azz3uV_ZZ/romney_concedes_south_carolina_primary/
[pubDate] => 18 hours ago +0000
)
)
)
이 왜 설명하고 나에게 매우 중요하다 태그를 반환하지 않습니다 'T는 모든 데이터를 반환, 내가 할 모든이가? CDATA
오, 몰랐습니다 ... 저는 XML을 처음 접했고 여러분에게 새로운 소식을 알게되었고 해결책을 얻었습니다. – Alex
지금 내가해야 할 일은 [설명]에서 데이터 (태그, 설명, 제출)를 분리하기 위해 preg_match라는 것입니다. 맞습니까? – Alex