Jump to content

Calling a php from another server


anshulmalhotra

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/279054-calling-a-php-from-another-server/
Share on other sites

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).  

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.