Monthly Archives:

August 2014

TECHNOLOGY

linkexchangefree.php

<?php
// THE BELOW PART IS USED TO FETCH AND DISPLAY LINK PARTNERS
// THE BELOW VARIABLES ARE USED TO FETCH DATA. THESE CAN BE MODIFIED

// number of columns to display categories
$cat_col =2;

//number of links per page
$linksperpage = 10;

//DO NOT MODIFY ANYTHING BELOW THIS LINE

// This is the user’s uniqueid provided by linkexchangefree.com and cannot be modified.
$userid = “MTg1OToxODY0”;

//Current page url
$currentpage = $_SERVER[“PHP_SELF”];

//NOTE: IF your links page displays “script name is undefined”, you are running an older PHP version. To solve this problem, remove the forward slashes from the below line

//$currentpage = $PHP_SELF;

//create variales to be sent to linkexchangefree.com
$querystring = “script=php”;
if(isset($HTTP_GET_VARS))
{
foreach ($HTTP_GET_VARS as $key => $value) {
$value = urlencode(stripslashes($value));
$querystring .= “&$key=$value”;
}
}

$poststring = “userid=” .$userid;
$poststring .= “&pagename=” .$currentpage;
$poststring .= “&cat_col=” .$cat_col;
$poststring .= “&linksperpage=” .$linksperpage;
$poststring .= “&”.$querystring;

$scripname = “index.php/link/getlinks”;
if(function_exists(“curl_init”)) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, “www.linkexchangefree.com/”.$scripname);

/* set the user agent – might help, doesn’t hurt */
//curl_setopt($ch, CURLOPT_USERAGENT, ‘Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)’);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $poststring);
/* try to follow redirects */
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

/* timeout after the specified number of seconds. assuming that this script runs
on a server, 20 seconds should be plenty of time to verify a valid URL. */
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);

$data = curl_exec($ch);
curl_close($ch);
echo $data;

} else {
$header = “POST “.$scripname . ” HTTP/1.0\r\n”;
$header .= “Content-Type: application/x-www-form-urlencoded\r\n”;
$header .= “Content-Length: ” . strlen($poststring) . “\r\n\r\n”;

// open a connection to linkexchangefree.com
$fp = fsockopen (‘www.linkexchangefree.com’, 80, $errno, $errstr, 30);

if (!$fp) {
// HTTP ERROR
echo “Some Error has occurred while processing request”;
} else {
// send form headers, form post
fputs ($fp, $header . $poststring);

// set our returned header flag to true, these we want to ignore
// initialize our body variable
$bHeader = true;
$data = “”;

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) $data .= $res;
}
echo $data;
fclose ($fp);
}
}
?>

error: Content is protected !!