jquery - Grab title from external url web page -


i'm trying title of external url web page

in view use following script

 <script>        $(document).ready(function(){                                  $(function(){                 $("#graburl").click(function(e){                     $.ajax({                         url: "<?php echo yii::app()->createurl('post/geturl', array('url' => 'http://bbc.co.uk)); ?>",                       success: function(data) {                       // how can content of title tag? or favicon ?                         }                    });             });         });     }); </script> 

my controller action does

public function actiongeturl($url) {     $str = file_get_contents($url);     return $str;   } 

what should put inside function data title , favicon ?

i suggest use: http://sourceforge.net/projects/simplehtmldom/files/

$html = file_get_html('http://www.google.com/'); $title = $html->find('title', 0)->innertext; $html->clear(); //important 

echo $title;


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -