cakephpでhttp通信し、xmlを取得して配列に入れる処理

はてなブックマーク - cakephpでhttp通信し、xmlを取得して配列に入れる処理
このエントリーをはてなブックマークに追加
Share on Facebook

cakephpを最近よくいじるのでその備忘録

App::import('HttpSocket');
App::import('Xml');
$http=&newHttpSocket();
$xml=&newXML($http->get('http://www.sj6.org/feed/'));
$xml=Set::reverse($xml);
pr($xml);

ほら、簡単でしょ!
と思ったら、こういう方法もあった

uses('Xml');
$xml = new XML("http://www.sj6.org/feed/");
$xml_array = Set::reverse($xml);
pr($xml);

楽チンやね。

コメントをどうぞ

メールアドレスが公開されることはありません。

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <img localsrc="" alt="">