Jump to content

Websites content reading code like title of any website.


ali_ggl
 Share

Recommended Posts

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

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

there's just no possibly way for you to do it with javascript. PHP can do this
He 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

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

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

  • 1 month later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...