G
G
gromanev2014-03-17 23:17:50
ASP.NET
gromanev, 2014-03-17 23:17:50

ASP.NET How to get server-defined website html code from client?

The idea is to get from the client the code of the page that the server points to. For example, the aaa.rf site has a video, a direct link to which is different for each client depending on the IP, and in order for me to get a link to the video from the aaa.rf service and insert this link into the player on my site (let's say BBB.com), you need to go to the video page on the AAA.rf website in the background thread and get the entire html code , then either transfer it to the server or process it with a JS function and get a direct link for this client.
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dmitrytut, 2014-03-19
@dmitrytut

You need to load the html code on the client using jQuery. Since browser security policies in most cases will block a direct request to a third-party resource, you need to include this library in your client code:
https://github.com/padolsey/jQuery-Plugins/blob/ma...
Then use ajax to get html:

function getHtml() {
         $.ajax({
           url: 'http://www.test.com',
           type: 'GET',
           success: function(res) {
             var content = $(res.responseText).text();
             alert(content);
           }
         });
       }

After that, the resulting html can be sent to the server in any way, for example, using the same $.ajax.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question