PHP -> PHP Communication Function
This function is used to communicate with a PHP script on another webserver.
$addr is a simple subdomain + domain.
$extra_dir is any directories added on to the domain.
$get_data is any GET data you'd like to pass.
Example:
I have a script at http://www.sineful.com/my_scripts/script.php, and I want to pass it "action=reload&data=1"
function export($addr, $extra_dir, $get_data = '') { if(!$addr) error('export(), ' . __LINE__ . ': No server address provided'); $fp = fsockopen($addr, 80); if(isset($get_data) && !is_null($get_data)) $extra_dir .= "?{$get_data}"; if($fp) { $out = "GET /{$extra_dir} HTTP/1.1\r\n"; $out .= "Host: {$addr}\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); fclose($fp); } } |
$addr is a simple subdomain + domain.
$extra_dir is any directories added on to the domain.
$get_data is any GET data you'd like to pass.
Example:
I have a script at http://www.sineful.com/my_scripts/script.php, and I want to pass it "action=reload&data=1"
export('www.sineful.com', 'my_scripts/script.php', 'action=reload&data=1'); |
Posted by Audeuro (Guildmaster) on Friday, July 27, 2007 11:03PM
- 0 comments
(link)
/
(Edited on Thursday, September 20, 2007 08:13PM)
Login to post a comment.