Hello guys, I hope this time i will at least a reply. (nobody reply to my last two email ) I am reading an article regarding php proxy as a work around to make ajax request cross domain. But I am not clear. can anyone give me a real example of how to use it. Let''s say I have two domain domainA.com and domainB.com the ajax server is on domainA.com from domainB.com the ajax request to ? and the proxy is installed on domainA.com or domainB.com for example in domainB.com html page including a javascript file using this? <script type="text/javascript" src="http://domainA.com/include.js"></script> or <script type="text/javascript" src="http://domainB.com/proxy.php?include.js"></script> Thanks for your kind reply,... Love Always YUAN -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Limitless undying love which shines around me like a million suns It calls me on and on across the universe...." Accross The Universe - The Beatles - -------------------------------------------- Visit : http://www.sabukhitam.com/ ===================== --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
OK, first of all, I''ll just say your example isn''t exactly the best, because you can of course, already include javascript files from other domains with no problems. And many Ajax frameworks offer what''s called "on demand javascript" (http://ajaxpatterns.org/On-Demand_Javascript), or dynamic script insertion, as an alternative transport to the XMLHTTP object in order to allow cross domain communications. There are some inherent risks in that, and the service you''re connecting to would have to be set up to only return javascript, so this is usually a method best suited for local development, or intranet development in other words (tightly controlled environments). This general rule of thumb, of course, can be broken if there are measures in place to ensure safe communications. Something else that helps here is if the service is configured to return JSONP ( http://ajaxian.com/archives/jsonp-json-with-padding). The server side proxy technique you speak of goes something like this, and is relevant if you are using the XMLHTTP object as the primary transport and still wish to communicate cross domain. Server A has an endpoint, which can be in the form of a SOAP based web service or something RESTful. On Server B you have an object that is able to make http calls to server A (I''m not sure what that is in PHP, but for instance in .NET there is one called WebClient). Now, on pages served by server B, you make calls to the proxy, and it then makes calls to A... waits for A to respond, and then uses the response from A to build it''s response to the client. On 6/6/07, Yuan Yudistira <sabukhitam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Hello guys, > > I hope this time i will at least a reply. > (nobody reply to my last two email ) > > I am reading an article regarding php proxy as > a work around to make ajax request cross domain. > > > But I am not clear. can anyone give me a real example > of how to use it. > > Let''s say I have two domain > domainA.com and domainB.com > the ajax server is on domainA.com > from domainB.com the ajax request to ? > and the proxy is installed on domainA.com or domainB.com > > for example > in domainB.com html page > including a javascript file using this? > > <script type="text/javascript" src="http://domainA.com/include.js > "></script> > > or > > <script type="text/javascript" > src="http://domainB.com/proxy.php?include.js"></script> > > > Thanks for your kind reply,... > > > Love Always > > > YUAN > > -- > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > "Limitless undying love > which shines around me like a million suns > It calls me on and on across the universe...." > Accross The Universe - The Beatles - > -------------------------------------------- > Visit : > http://www.sabukhitam.com/ > =====================> > > >-- Ryan Gahl Principal, Manager Nth Penguin, LLC - Consulting http://www.nthpenguin.com -- Software Architect WebWidgetry.com / MashupStudio.com Future Home of the World''s First Complete Web Platform -- Inquire: 1-262-951-6727 Blog: http://www.someElement.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Jun 6, 2007, at 8:58 PM, Ryan Gahl wrote:> ... On Server B you have an object that is able to make http calls > to server A (I''m not sure what that is in PHP, but for instance > in .NET there is one called WebClient).In PHP, the curl library is probably the most common. http:// us.php.net/manual/en/ref.curl.php If you''re running PHP 5.0 or greater, there are also the http series of classes. http://us.php.net/manual/en/ref.http.php Depending on your php.ini configuration, file_get_contents() might also be used: http://us.php.net/manual/en/function.file-get-contents.php TAG --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
ok thanks for you reply. I am reffering to article on this page http://developer.yahoo.com/javascript/howto-proxy.html thanks YUAN On 6/7/07, Tom Gregory <tomg-PGZyUNKar/Q@public.gmane.org> wrote:> > On Jun 6, 2007, at 8:58 PM, Ryan Gahl wrote: > > > ... On Server B you have an object that is able to make http calls > > to server A (I''m not sure what that is in PHP, but for instance > > in .NET there is one called WebClient). > > In PHP, the curl library is probably the most common. http:// > us.php.net/manual/en/ref.curl.php > > If you''re running PHP 5.0 or greater, there are also the http series > of classes. http://us.php.net/manual/en/ref.http.php > > Depending on your php.ini configuration, file_get_contents() might > also be used: http://us.php.net/manual/en/function.file-get-contents.php > > > > TAG > > > >-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Limitless undying love which shines around me like a million suns It calls me on and on across the universe...." Accross The Universe - The Beatles - -------------------------------------------- Visit : http://www.sabukhitam.com/ ===================== --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---