0

Is there any way, where I can make a cross site get call to another server, so I can grab some content?

If no, anyone know a better solution, so I can get all html imported to another site?

calebds
  • 25,670
  • 9
  • 46
  • 74
Simon Thomsen
  • 1,351
  • 7
  • 27
  • 37
  • possible duplicate of [Ways to circumvent the same-origin policy](http://stackoverflow.com/questions/3076414/ways-to-circumvent-the-same-origin-policy) – Rob W Mar 20 '12 at 20:28

2 Answers2

1

What I usually do is set up a PHP page

fetcher.php

<?php
    die(file_get_contents('http://www.otherdomain.com/service.aspx'));
?>

Then your ajax can just get fetcher.php

Dutchie432
  • 28,798
  • 20
  • 92
  • 109
  • It needs to be a bit of code, I install on the clients site, so it takes some data from my site. So that solution isn't that good in this case (cleaver hack otherwise!) – Simon Thomsen Mar 20 '12 at 20:31
  • Cant you just do it the other way around? – Dutchie432 Mar 20 '12 at 20:54
  • Have you a example. Maybe you have a smart solution on how I can implement "fetcher.php" – Simon Thomsen Mar 20 '12 at 21:00
  • simply put fetcher.php on the client's site. change its URL to the data URL on your site (`http://www.yoursite.com/whatever`). Then whenever your client's site wants to get data from `http://www.yoursite.com/whatever`, it can instead fetch it from fetcher.php. You can even take this one step further and pass the desired url to the PHP page so you can use it for any cross domain url. – Dutchie432 Mar 21 '12 at 12:32
0

use a server proxy to sit between you and the remote site or you can use jsonp if the server on other domain supports it ...

Rafay
  • 30,950
  • 5
  • 68
  • 101