anshulmalhotra Posted June 11, 2013 Share Posted June 11, 2013 Hi all, I am trying to call a php file currently stored on my web hosting server to a HTML code being written on a different server.. This HTML code should be able to execute this php file and then retrieve a value that is getting stored in a variable named $url within the php file.. This variable is randomly generated each time the php file is run.. Please assist.. Kindly ask for more info as required. Cheers Quote Link to comment https://forums.phpfreaks.com/topic/279054-calling-a-php-from-another-server/ Share on other sites More sharing options...
rwhite35 Posted June 11, 2013 Share Posted June 11, 2013 You're going to run in to the Same Origin Policy which basically restricts server A remote code from running on server B. API's and SDK get around this policy by using keys and single source signon schemes. You can load a remote page in an <iframe> tag, however that code can't make runtime instructions without some special setup (reverse proxy server). Quote Link to comment https://forums.phpfreaks.com/topic/279054-calling-a-php-from-another-server/#findComment-1435455 Share on other sites More sharing options...
anshulmalhotra Posted June 12, 2013 Author Share Posted June 12, 2013 Thanks for that rwhite.. I am quite a rookie in php and web programming.. So is there a way around this and if so can u refer me to someplace tht I can get assistance with it?? Quote Link to comment https://forums.phpfreaks.com/topic/279054-calling-a-php-from-another-server/#findComment-1435496 Share on other sites More sharing options...
cyberRobot Posted June 13, 2013 Share Posted June 13, 2013 Can you provide any more specifics on what you're looking to do? Have you considered passing the necessary information using GET variables? PHP file 1 could send a flag to file 2 which generates the variable. File 2 can then send the variable back to file 1 using a header redirect. http://php.net/manual/en/function.header.php Quote Link to comment https://forums.phpfreaks.com/topic/279054-calling-a-php-from-another-server/#findComment-1435725 Share on other sites More sharing options...
DaveyK Posted June 13, 2013 Share Posted June 13, 2013 It all really depends on what you want to do... If there is no user involved (or you want all of it on the backend), you can use file_get_contents() right? Quote Link to comment https://forums.phpfreaks.com/topic/279054-calling-a-php-from-another-server/#findComment-1435736 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.