PDA

View Full Version : Pointing to more than one webpost?


PrimalFear
03-06-2003, 05:26
Is it possible to point to more than one website in the server.ini file, I saw it mentioned somewhere but cant find the post, cant remember if it was posible or not.
Many Regards Primal.:)

PrimalFear
08-06-2003, 00:55
Anybody

PrimalFear
08-06-2003, 20:44
bump

Exo
11-06-2003, 11:42
IIRC it isn't currently possible with TS itself. But you could point to a webpost which delivers the data to different webposts.

The essential code in PHP would be something like this (untested!)
$uris = array(
"http://domain1.com/webpost.php",
"http://domain2.com/webpost.php",
"http://domain3.com/webpost.php",
);

foreach ($uris as $uri) {
@readfile($uri."?".$_SERVER["QUERY_STRING"]);
}

PrimalFear
11-06-2003, 22:56
Thank you, can you tell me in which php file I would add this?

Exo
12-06-2003, 16:13
This code needs to be in its own PHP file, e.g. dispatch.php . The TS Server would then point to this file in its webpost configuration.

Spudster
28-08-2003, 22:36
Does anyone know if this actually works?

Spudster
24-10-2003, 23:04
Still looking to see if anyone has been able to accomplish this.

Many Thanks,

Spudster

Spudster
26-11-2003, 22:37
Anyone?

Here's what I've got.....

<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
<?php

$uris = array(
"http://www.webpost1.com/webpost.php",
"http://www.webpost2.com/webpost.php",
"http://www.webpost3.com/webpost.php",
"http://www.webpost4.com/webpost.php"
);

foreach ($uris as $uri) (
@readfile($uri."?".$_SERVER["QUERY_STRING"])
)

?>



</body>
</html>


It doesn't work, can someone fill me in on the details why? I have substituted the www.webpost1.com addresses in the actual script.

Thanks!

Spudster
20-02-2004, 22:48
After many brain throbing nights, here's how to make it work.

You will need to make sure your webserver & PHP have cURL installed and running for it to work. I named it pushpost.php and pointed my webserver to it, then it replicates the information out to more than one webpost.

-Spudster


<?php

// gather the incoming data from the Teamspeak Server.

$server_adminemail = urlencode($_REQUEST['server_adminemail']);
$server_isplinkurl = urlencode($_REQUEST['server_isplinkurl']);
$server_linkurl = urlencode($_REQUEST['server_linkurl']);
$server_name = urlencode($_REQUEST['server_name']);
$server_ispname = urlencode($_REQUEST['server_ispname']);
$server_ispcountry = urlencode($_REQUEST['server_ispcountry']);
$server_password = urlencode($_REQUEST['server_password']);
$server_port = $_REQUEST["server_port"];
$server_platform = $_REQUEST['server_platform'];
$server_version_major = $_REQUEST['server_version_major'];
$server_version_minor = $_REQUEST['server_version_minor'];
$server_version_release = $_REQUEST['server_version_release'];
$server_version_build = $_REQUEST['server_version_build'];
$server_uptime = $_REQUEST['server_uptime'];
$server_type1 = $_REQUEST['server_type1'];
$server_type2 = $_REQUEST['server_type2'];
$clients_current = $_REQUEST['clients_current'];
$clients_maximum = $_REQUEST['clients_maximum'];
$channels_current = $_REQUEST['channels_current'];
$server_queryport = $_REQUEST['server_queryport'];

// Determine the server's IP Address
if (getenv("HTTP_X_FORWARDED_FOR")) {
$server_ip = getenv("HTTP_X_FORWARDED_FOR");
if ($server_ip == '') {
$server_ip = $_SERVER["REMOTE_ADDR"];
}
$server_ip = preg_replace( "/,.*$/", "", $server_ip );
} else {
$server_ip = getenv("REMOTE_ADDR");
if ($server_ip == '') {
$server_ip = $_SERVER["REMOTE_ADDR"];
}
}

// Organize the new _POST
$postquery = "server_ip=$server_ip&server_port=$server_port&server_adminemail=$server_adminemail&server_isplinkurl=$server_isplinkurl&server_linkurl=$server_linkurl&server_name=$server_name&server_ispname=$server_ispname&server_ispcountry=$server_ispcountry&server_password=$server_password&server_platform=$server_platform&server_version_major=$server_version_major&server_version_minor=$server_version_minor&server_version_release=$server_version_release&server_version_build=$server_version_build&server_uptime=$server_uptime&server_type1=$server_type1&server_type2=$server_type2&clients_current=$clients_current&clients_maximum=$clients_maximum&channels_current=$channels_current&server_queryport=$server_queryport";

// Set Array of sites to post to
$uris = array(
"http://www.somewebsite1.com/webpost.php",
"http://www.somewebsite2.com/webpost.php",
"http://www.somewebsite3.com/webpost.php",
);

// Loop to execute posts (Requites cURL to be installed and running)
foreach ($uris as $uri) {
$ch = curl_init();
$remote_url = $uri;
curl_setopt ($ch, CURLOPT_URL, $remote_url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postquery);
ob_start();
curl_exec ($ch);
curl_close ($ch);
$curl_results = ob_get_contents();
echo $curl_results;
ob_end_clean();
};

?>

SARO91201
11-03-2004, 06:26
ok I just tried that script and I get this error message:


Fatal error: Call to undefined function: curl_init() in /home3/beer/public_html/*****/ts2/webpost2.php on line 52


How do I fix this?

Spudster
11-03-2004, 16:52
Originally posted by SARO91201
ok I just tried that script and I get this error message:


Fatal error: Call to undefined function: curl_init() in /home3/beer/public_html/*****/ts2/webpost2.php on line 52


How do I fix this?

You will need to have cURL installed on your webserver. You can download it from http://curl.haxx.se/download.html

This is the magic item that makes the script work.

Good Luck - Spudster

SARO91201
11-03-2004, 23:56
I already have curl installed and running as I have to have it for my modernbill that I already use.

Spudster
12-03-2004, 17:15
I dont think cURL is installed by dedfault with modernbill. refer to http://manual.modernbill.com/adminhelp/english/Installation/cURL_Setup.htm maybe this can help.

I am running cURL on a WIN2K server. I had to manually install cURL to work with PHP.

Thanks,

Spudster