What is needed is as follows:
I have an HTML webpage and I need to access another website and get something from its source code.
I want to run something like
link = "http://www.google.com";
doc.querySelectorAll('#courses_menu > ul > li > a'); // Apply on the link.
to get what I need from the link and use it!
However, I am using Jetpack slide bar.
Does it have to do anything with HTTP requests?
I think you could pull the entire page using an Ajax request, put the content in a hidden iframe, and then manipulate the DOM in the iframe. Something like (here using the jQuery framework)
<iframe id="holder" style="display: none">
<script type="text/javascript">
$("#holder").load("http://www.google.com",function () {
$link = $("#holder").contents().find("#courses_menu > ul > li > a");
});
</script>
I recommend using a Ajax (e.g. jquery) with a PHP proxy on the same Webserver. The Proxy loads the the remote webpage and is then available under the same domain.
Don't forget to protect the proxy against abuse.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With