Querying information from a website

1

I need to check out link and get the value that is in meta name="member_count" content="53" in this case 53

Try to see if I can explain myself better.

I want to make a JS that can get the number of members of the link that I posted up

So I hope I can get this information and can manipulate this value

The goal is to be able to display on my site the number of group members that shows in the posted link

What is the best method to do this?

I'm trying to make a request XMLHttpRequest but I did not succeed

  function loadXMLDoc(){
    var xmlhttp; 
    if (window.XMLHttpRequest){
        xmlhttp=new XMLHttpRequest(); 
    }else{
        xmlhttp=new
        ActiveXObject("Microsoft.XMLHTTP"); 
    }

    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4 && xmlhttp.status==200){
            document.getElementById("myDiv").innerHTML=xmlhttp.responseText; 
        } 
    }

    xmlhttp.open("GET","http://world.secondlife.com/resident/24e6998d-7bf2-4d03-b38b-acf8f2a21fc1",true);

    xmlhttp.send(); 
}

<input type="button" onclick="loadXMLDoc()">Request data</button>
<div id="myDiv"></div>
    
asked by anonymous 16.12.2014 / 11:57

1 answer

1

CORS is a mechanism that allows resources from one server to be accessed from a page in another domain of the original domain. This happens to avoid just what you are trying to do and preserve server resources such as bandwith and processing (which in the end cost money).

Some sites enable CORS, for example, the stackoverflow and github , but when that happens they usually limit the amount of requests you can make, also to prevent abuse.

The site you are trying to get the information does not allow CORS: XMLHttpRequest cannot load http://world.secondlife.com/resident/24e6998d-7bf2-4d03-b38b-acf8f2a21fc1?_=1418‌​733119899. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://jsbin.com' is therefore not allowed access.

This limitation is not enforced if you access SERVER-SERVER, as you yourself found.

The solution for you would be to implement a proxy on your server to communicate with this site. You do not necessarily need to store this information in a database.

READ ALSO:

1- Policy of the same origin
2

    
16.12.2014 / 14:09