创建数据库和包含函数

时间:2016-02-02 15:37:40

标签: php mysql

首先,谢谢你的帮助。我想采取这个处方并且有一个例子,但我不知道如何知道这个文件:/includes/config_lite.php。所以你因此寻求帮助!

以下是整个代码的示例:



<?php /*?>
AdWork Media Campaign API Example
Copyright 2012 AdWork Media Group, LLC
Automatically access a real-time feed that can be sorted for optimization and targetted to the user's IP address.
<?php */?>

<? 
// Create DB Connection
// include('config.php');
// Optionally include any functions files
// include('functions.php'); 

include($_SERVER['DOCUMENT_ROOT'] . '/includes/config_lite.php');

$SUBID=''; // DEFINE the SUB ID for all tracking links

function GetIP()
{
    foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key)
    {
        if (array_key_exists($key, $_SERVER) === true)
        {
            foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip)
            {
                if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false)
                {
                    return $ip;
                }
            }
        }
    }
}

$userIP=mysql_real_escape_string(GetIP());

// CALL YOUR API URL
// Recommended to use optimize=EPC and oType=2 for Best Earnings
// REPLACE URL BELOW WITH YOUR URL OR ENTER YOUR PUB ID AND API KEY
$OfferFeed = simplexml_load_file("http://www.adworkmedia.com/api/index.php?pubID=YOURPUBID&apiID=YOURAPIKEY&campDetails=true&optimize=EPC&oType=2&userIP=".$userIP);

foreach ($OfferFeed as $singleOffer) { ?>
	 <a style="font-size:16px;" href="<?php echo $singleOffer->url;?><?=$SUBID;?>" target="_blank"><b><?php echo stripslashes($singleOffer->teaseText);?></b></a> Additional Details &raquo; Campaign Name: <?php echo $singleOffer->campaign_name;?> | Conversion Point: <?php echo $singleOffer->conversion_point;?><br />
<? } 
// MORE DETAILS can be added - See the full API Documentation here: https://www.adworkmedia.com/publisher/index.php?option=tools&section=api_reporting
?>
&#13;
&#13;
&#13;

0 个答案:

没有答案