ali_ggl Posted January 24, 2008 Share Posted January 24, 2008 Hi all here at web forum i want to develop websites content reading code like title of any website or meta and other tags, i want to give URL to this code at run time and it will detect its meta, title or other information and return to me in variables how to do and which language will be use for it like JavaScript, PHP, ASP, ASP.NET or JSP etc.Please guide me with helpful links or sources.Thanks.Ali. Link to comment Share on other sites More sharing options...
jhecht Posted January 24, 2008 Share Posted January 24, 2008 Javascript would be nice, except for the fact that it can't load things from an off-domain source. So unless all the information you want to read is in the same domain, there's just no possibly way for you to do it with javascript. PHP can do this, although it's a bit more annoying to do so. I don't know about ASP, ASP.NET, or JSP(never really use them). Basically, choose your poison n hop in. Link to comment Share on other sites More sharing options...
Synook Posted January 24, 2008 Share Posted January 24, 2008 there's just no possibly way for you to do it with javascript. PHP can do thisHe could AJAX a PHP page which echo file_get_contents() the external URL, so he gets the best of both worlds. Link to comment Share on other sites More sharing options...
jhecht Posted January 24, 2008 Share Posted January 24, 2008 Yes, he could use AJAX, if the file(s) he/she was reading were on the same server. AJAX cannot go accross domains(i.e. something on domain.com cannot try to request something from otherdomain.com). Link to comment Share on other sites More sharing options...
justsomeguy Posted January 24, 2008 Share Posted January 24, 2008 I think he was suggesting to send an AJAX request to a local PHP page which would get the remote file and output it. Link to comment Share on other sites More sharing options...
Synook Posted January 25, 2008 Share Posted January 25, 2008 E.g. //Let var xmlHttp be new xmlHttpRequestObject() or ActiveX equiv//Let page be the URL of desired pagexmlHttp.open("GET", "getcontent.php?page=" + page, true);xmlHttp.onreadystatechange = function() {if (xmlHttp.readyState == 4) {var title = /<title(.*?)>(.*?)<\/title>/i;title = title.exec(xmlHttp.responseText)[2];//var title now contains the title of the page}}xmlHttp.send(null); getcontent.php <?phpecho file_get_contents($_GET['page']);?> Link to comment Share on other sites More sharing options...
ali_ggl Posted March 13, 2008 Author Share Posted March 13, 2008 Thanks for reply to my question guyes i got the answer with this single line of PHP. <?phpecho file_get_contents("http://www.google.com");?> Ali. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.