JavaScript CORS Request: Get remote page via DOM without CORS restrictions

Recommend this page to a friend!
  Info   View files Example   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 41 All time: 510 This week: 4Up
Version License JavaScript version Categories
js-url-cparser 1.0Custom (specified...5HTML
Description Author

This object can get remote page via DOM without CORS restrictions.

It can retrieve a page from a given remote site URL working around CORS restrictions by using a server side PHP script to get the page.

The object provides access to the parsed remote page via a DOM object.

It can also display a representation of the retrieved page structure inside a given element of a current page.

Recommendations

Extract Meta Tags
I need URL parser to extract the meta tags

Picture of zinsou A.A.E.Moïse
  Performance   Level  
Name: zinsou A.A.E.Moïse <contact>
Classes: 3 packages by
Country: Benin Benin
Age: 33
All time rank: 1732 in Benin Benin
Week rank: 6 Up1 in Benin Benin Up

Details
grab a page locally from given URL to handle its DOM tree with native JavaScript DOM methods ,without CORS limitations *how to use* var url='https://www.phpclasses.org/'; var UP=new UrlCParse(url); UP.parseUrl('manage'); document.getElementById(UP.getResponse).onload=function(){ alert(e.detail.data.url_img[0].src);//here you can find the parsed data in the e.detail.data object } //or a better and sure way: document.getElementById(UP.getResponse).addEventListener("UrlParsed", function(e){ alert(JSON.stringify(e.detail.data.url_meta));//here you can find the parsed data in the e.detail.data object }, false); //or a more simple way var url='https://www.phpclasses.org/'; var UP=new UrlCParse(url); UP.parseUrl('manage',response={}); document.getElementById(UP.getResponse).addEventListener("UrlParsed", function(){ alert(JSON.stringify(response.data.url_meta));//here you can find the parsed data in the response.data object }, false); for a local use when the url you try to parse is from the same domain as the requester you can avoid the PHP file usage by specifying true in the constructor as second parameter. Note that the usage of PHP in the package is mainly to go around the CORS limitations.And thus is very worth when you want to parse different domain's (from yours) urls. these are the full list of objects you will find in the data object: data = { [url_meta] => { [name]=>"content", etc........... } [url_title] => "title textnode" [url_http_equiv] => {http-equiv meta tags} [url_twitter_meta] => {twitter meta tags} [url_og_meta] => {open graph meta tags} [url_h1] => "textnode", [url_h2] => { [0]=>"textnode", etc... }, [url_h3] => { [0]=>"textnode", etc... }, [url_h4] => { [0]=>"textnode", etc... }, [url_h5] => { [0]=>"textnode", etc... }, [url_h6] => { [0]=>"textnode", etc... }, [url_links] => { [textnode]=>"href attribute", etc..... }, [url_img] => { [0]=>{ [src]=>"", [alt]=>"" }, etc..... } } In the example above we use the element 's ID "manage" as the parseUrl method first parameter.This is useful only to print a brute format of the object data in the chosen element.To avoid this behavior you can fill an empty string or an inexistent ID. You can also use this object "e.detail.document" to handle the parsed URL DOM tree directly in your code or in the short way if your response variable is "response" for example : response.document. example: alert(response.document.getElementsByTagName('title')[0].innerText); //or alert(e.detail.document.getElementsByTagName('title')[0].innerText);
  Files folder image Files  
File Role Description
Accessible without login Plain text file getUri.php Aux. php script useful to avoid CORS limitations
Plain text file js.urlcparser.js Class class source
Accessible without login Plain text file license.txt Lic. license file
Accessible without login Plain text file new.html Example example script
Accessible without login Plain text file readme.txt Doc. readme
Accessible without login Plain text file test.html Example example script

 Version Control Unique User Downloads Download Rankings  
 0%
Total:41
This week:0
All time:510
This week:4Up