<?php
// # THE FOLLOWING BLOCK IS USED TO RETRIEVE AND DISPLAY LINK INFORMATION.
// # PLACE THIS ENTIRE BLOCK IN THE AREA YOU WANT THE DATA TO BE DISPLAYED.
// # MODIFY THE VARIABLES BELOW:
// # Enter your user key below (provided to you by Free-Link-Exchange.com):
$UserKey = "561413582012-MYXOEEF1Y1T3AYS";
// # The following variable defines how many columns are used to display categories
$CategoryColumns = "2";
// # The following variable defines how many links to display per page
$LinksPerPage = "25";
// # The following variable defines whether links are opened in a new window
// # (1 = Yes, 0 = No)
$OpenInNewWindow = "1";
// # The following variable determines whether the search function is enabled
// # for your links page (1 = Yes, 0 = No)
$AllowSearch = "1";
// # DO NOT MODIFY ANYTHING ELSE BELOW THIS LINE!
// ----------------------------------------------
$ThisPage = $_SERVER["PHP_SELF"];
// # NOTICE!!!!!
// # If your links page states "Script Name Undefined." when you run this,
// # your web host is probably running an older version of PHP. To correct
// # this problem, remove the two forward slashes from the line below:
// $ThisPage = $PHP_SELF;
$PostingString = "UserKey=" .$UserKey;
$PostingString .= "&ScriptName=" .$ThisPage;
$PostingString .= "&CatCols=" .$CategoryColumns;
$PostingString .= "&LinksPerPage=" .$LinksPerPage;
$PostingString .= "&OpenInNewWindow=" .$OpenInNewWindow;
$PostingString .= "&AllowSearch=" .$AllowSearch;
$QueryString = "script=php";
foreach ($HTTP_GET_VARS as $key => $value) {
$value = urlencode(stripslashes($value));
$QueryString .= "&$key=$value";
}
if(function_exists("curl_init")) {
echo curl_post("www.Free-Link-Exchange.com/smbin/dumplinks.asp?" . $QueryString, $PostingString);
} else {
// congfigure our headers
$header = "POST /smbin/dumplinks.asp?" . $QueryString . " HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($PostingString) . "\r\n\r\n";
// open a connection to Free-Link-Exchange
$fp = fsockopen ('www.Free-Link-Exchange.com', 80, $errno, $errstr, 30);
if (!$fp) {
// HTTP ERROR
echo "Error processing request";
} else {
// send form headers, form post
fputs ($fp, $header . $PostingString);
// set our returned header flag to true, these we want to ignore
// initialize our body variable
$bHeader = true;
$sData = "";
while (!feof($fp)) {
$res = fgets ($fp, 8192);
$res = ereg_replace("[\r\n]", "", $res);
// if we have an empty line, we are now past the headers.
// set the flag so we can start retrieving data
if (strlen($res) == 0) $bHeader = false;
if ($bHeader == false) $sData .= $res;
}
echo $sData;
fclose ($fp);
}
}
function curl_post( $Url, $postData)
{
$ch = curl_init($Url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
?>