-4

I have a php script(example.php), which is using multiple cURL to load 20 pages at the same time.. for example google.com, ebay.com .. It takes 5 seconds to load example.php and its quite a lot so.. I also have a simple html file(index.html) with short loadtime . And what I want is : having a script included in index.html which gets element by id from pages loaded in example.php And why? I want to have a page with fast load time(index.html), which could get elements from sites like google.com, ebay.com, facebook.com (which are actually loaded in example.php on the background) ... Example.php and index.html are on the same domain, so there should be no problem with that..

  • 2
    Please restructure this question so it is readable and add some of your existing code. If not, watch it get downvoted and closed real quick. PS: You cannot access other sites cross origin on the client – mplungjan Feb 07 '14 at 14:08
  • You should rewrite your `example.php` to load individual external pages and call that multiple times from your `index.php` using ajax. As soon as an individual external page is available, you can process it. – jeroen Feb 07 '14 at 14:18

1 Answers1

2

Accessing content from external websites can't be done easily with Javascript due to the Same Origin Policy. You can however display the entire page in one go by use of an iframe.

You can circumnavigate this with a variety of methods using the server as neatly provided here.

Community
  • 1
  • 1
Rohan
  • 3,296
  • 2
  • 32
  • 35