fil79 Posted December 9, 2009 at 05:35 PM Report Share #299506 Posted December 9, 2009 at 05:35 PM Boas Preciso de fazer um rss num site http://economico.sapo.pt/rss.html Já o fiz uma vez, mas na altura só tinha de apontar o script php para um ficheiro XML, o que não se verifica aqui. Já agora, não tenho mais esse script, se alguém me podesse dar alguma dica onde posso arranjar isso, agradecia muito. MCITP-MCTS-MCP Link to comment Share on other sites More sharing options...
cyclop Posted December 9, 2009 at 06:18 PM Report Share #299516 Posted December 9, 2009 at 06:18 PM Simples: http://www.php.net/simplexml_load_file "Quando eu for grande quero ser como o Celso" Link to comment Share on other sites More sharing options...
fil79 Posted December 9, 2009 at 06:31 PM Author Report Share #299517 Posted December 9, 2009 at 06:31 PM obrigado! 😄 mas onde posso encontrar o xml que serve de feed,. neste caso: http://economico.sapo.pt/rss/ultimas.html MCITP-MCTS-MCP Link to comment Share on other sites More sharing options...
fil79 Posted December 10, 2009 at 02:37 AM Author Report Share #299547 Posted December 10, 2009 at 02:37 AM alguém MCITP-MCTS-MCP Link to comment Share on other sites More sharing options...
yoda Posted December 10, 2009 at 10:56 AM Report Share #299564 Posted December 10, 2009 at 10:56 AM Vê o source code desse link. Verás que é xml, apesar de ter extensão em html. before you post, what have you tried? - http://filipematias.info sense, purpose, direction Link to comment Share on other sites More sharing options...
fil79 Posted December 10, 2009 at 01:03 PM Author Report Share #299596 Posted December 10, 2009 at 01:03 PM tens razão, mas para colocar essas noticias no meu site não preciso de apontar o meu script php a um xml? MCITP-MCTS-MCP Link to comment Share on other sites More sharing options...
yoda Posted December 10, 2009 at 01:03 PM Report Share #299597 Posted December 10, 2009 at 01:03 PM Não, precisas é que o conteúdo do ficheiro seja xml. Usa o SimpleXML que é fácil de usar 😄 before you post, what have you tried? - http://filipematias.info sense, purpose, direction Link to comment Share on other sites More sharing options...
fil79 Posted December 10, 2009 at 04:12 PM Author Report Share #299638 Posted December 10, 2009 at 04:12 PM ok, obrigad vou ver isso e se tiver dúvidas coloco 😄 MCITP-MCTS-MCP Link to comment Share on other sites More sharing options...
fil79 Posted December 10, 2009 at 04:24 PM Author Report Share #299642 Posted December 10, 2009 at 04:24 PM estou a guiar-me por este tutorial: http://www.scriptfacil.com.br/script/1865/13/manipulando-xml-com-simplexml-no-php.html e esbarro logo no inicio: if( file_exists('exemplo1.xml') ) { se coloco o link em causa dá logo erro!!!! MCITP-MCTS-MCP Link to comment Share on other sites More sharing options...
yoda Posted December 10, 2009 at 04:51 PM Report Share #299651 Posted December 10, 2009 at 04:51 PM claro que dá, estás a tentar encontrar um link com uma função de verificação de ficheiros 😄 before you post, what have you tried? - http://filipematias.info sense, purpose, direction Link to comment Share on other sites More sharing options...
fil79 Posted December 10, 2009 at 04:54 PM Author Report Share #299652 Posted December 10, 2009 at 04:54 PM sim, tens razão, mas como posso aceder ao xml de http://economico.sapo.pt/rss/ultimas ? MCITP-MCTS-MCP Link to comment Share on other sites More sharing options...
yoda Posted December 10, 2009 at 05:02 PM Report Share #299658 Posted December 10, 2009 at 05:02 PM <?php $xml = simplexml_load_file('http://economico.sapo.pt/rss/ultimas'); foreach ($xml->channel->item as $noticia) { // stuff } ?> Algo assim .. before you post, what have you tried? - http://filipematias.info sense, purpose, direction Link to comment Share on other sites More sharing options...
fil79 Posted December 10, 2009 at 05:08 PM Author Report Share #299660 Posted December 10, 2009 at 05:08 PM ok..muito obrigado pela paciència, vou testar e espero não voltar aqui 😄 MCITP-MCTS-MCP Link to comment Share on other sites More sharing options...
fil79 Posted December 10, 2009 at 06:29 PM Author Report Share #299679 Posted December 10, 2009 at 06:29 PM realmente o simple xml é mesmo simples <? header('Content-type: text/html; charset=utf-8'); $xml = simplexml_load_file('http://economico.sapo.pt/rss/ultimas'); foreach ($xml->channel->item as $noticia) { $titulo=$noticia->title; $noticia=$noticia->description; $link=$noticia->link; echo "<h2>".$titulo."</h2><br>"; echo $noticia."<br>"; } ?> muito obrigado pela ajuda 😄 MCITP-MCTS-MCP Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now