Brandon_R Posted October 4, 2009 Share Posted October 4, 2009 Hello wonderful users of this forum. I tried searching for this but to no avail. Can someone show me how to get the page title of a url and its meta description and return them onto the page in a textarea? I will be truly grateful. The only thing i can get right it the HTML aspect of this piece of code Quote Link to comment https://forums.phpfreaks.com/topic/176463-tried-searching-but-to-no-avail-get-page-title-and-description-via-ajax/ Share on other sites More sharing options...
gr1zzly Posted October 5, 2009 Share Posted October 5, 2009 Javascript can access web document header information through the Navigator and Document objects Or you could try AJAX based header response functions: http://www.w3schools.com/dom/dom_http.asp Whether or not these will let you access the 'title' and 'meta-description' tags I don't know. If not you may need to save a temporary copy of the web page as a text file on the server, then retrieve the information you desire through a text string analysis of the file using php or something -> using strrpos() to find the start and end tags then copy whats between them. Quote Link to comment https://forums.phpfreaks.com/topic/176463-tried-searching-but-to-no-avail-get-page-title-and-description-via-ajax/#findComment-930872 Share on other sites More sharing options...
RichardRotterdam Posted October 5, 2009 Share Posted October 5, 2009 I tried searching for this but to no avail. What results have you gotten what have you tried? Can someone show me how to get the page title of a url and its meta description and return them onto the page in a textarea? Will these url's be on the same domain or a different one? And what serverside languages do you have? Is there a reason you want to use ajax? I will be truly grateful. The only thing i can get right it the HTML aspect of this piece of code Just HTML won't get you far do you have a basic understanding of any programming language? Quote Link to comment https://forums.phpfreaks.com/topic/176463-tried-searching-but-to-no-avail-get-page-title-and-description-via-ajax/#findComment-930883 Share on other sites More sharing options...
Brandon_R Posted October 5, 2009 Author Share Posted October 5, 2009 Thanks for your help guys but i got it. Instead of doing the entire thing via ajax i just did the call to a php file that got the title and description and returned it. Quote Link to comment https://forums.phpfreaks.com/topic/176463-tried-searching-but-to-no-avail-get-page-title-and-description-via-ajax/#findComment-931032 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.