1

I've run into a situation where one of my company's clients is building a website with our service, but would like to include on our site the podcasts that get posted into a table dynamically generated on a page of their main business site.

I've done a bit with ajax before, I know one of the biggest hurdles is using ajax to access content on a site hosted on a different server. From my research I gather that JSONP is the best solution in a situation like this, but for argument's sake let's say I know nothing of how their server is configured (and have no realistic way to find out) and that I don't know much about JSON (which is true).

I probably shouldn't hope for a silver bullet in a situation like this, but can someone point me at least in the right direction?

Thanks!

3 Answers3

1

Create your own service with PHP that calls the AJAX service, that way you can call any remote service you want but the ajax call is to your domain. I can provide an example if you like.

greg
  • 6,853
  • 15
  • 58
  • 71
  • I'd use the terminology of a "proxy" to help explain what you've describe, but yes this is also a good approach. – Scuzzy Jun 06 '12 at 00:38
0

If you can use jQuery, have a look at jQuery AJAX cross domain, otherwise, throw one of the following header functions into script that serves the request and see if this helps.

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Origin: http://permitted_domain.com');

This is something that the client browser supports, so your mileage may vary

for a non AJAX/Javascript solution, URL fetching mechanisms like file_get_conents() (note this configuration) or using cURL can be used to achieve similar (if not more inline) results

Community
  • 1
  • 1
Scuzzy
  • 12,186
  • 1
  • 46
  • 46
0

You can use curl in situations like this.

subroutines
  • 1,458
  • 1
  • 12
  • 16