Cross Domain Request Using Javascript

Bismillah

NO, you can't do cross domain request using Javascript, for example to get another content from www.google.com to your domain.com using Ajax. What you can do just create another page containing some php functions like file_get_contents and stream_context_create. The idea is using another page from the same host (so you can use your fancy loading image or alike and make your xml http request works) that get content from another host.

index.php <- xml-http-request -> another-page.php <- file_get_contents+stream_context_create <- www.anotherdomain.com/?q=123

Tidak ada komentar:

Posting Komentar

speak now or forever hold your peace

About Me