Millennial Media PHP Setup ( Code Integration )
<p>I know this going to be very easy question for people with good PHP knowledge.</p>

<p>I have a WordPress website self hosted. I designed it for mobile devices and I would like to install Millennial Media advertisements in it. Millennial Media does not really provide detailed instructions and web resources strangely are not available!</p>

<p>I have knowledge in HTML,CSS and JavaScript but very poor in PHP :( .
any way I can do some changes PHP to achieve what I want, but I can't write them from zero and integrate them by my self.</p>

<p>Ok long story short 
This the code provided by Millennial Media:</p>

<pre><code>&lt;?php 
/*--------------------------------------------------------------*/ 
/* Millennial Media PHP Ad Coding, v.7.4.20                     */ 
/* Copyright Millennial Media, Inc. 2006                        */ 
/*                                                              */ 
/* The following code requires PHP &gt;= 4.3.0 and                 */ 
/* allow_url_fopen 1 set in php.ini file.                       */ 
/*                                                              */ 
/* NOTE:                                                        */ 
/* It is recommended that you lower the default_socket_timeout  */ 
/* value in the php.ini file to 5 seconds.                      */ 
/* This will prevent network connectivity from affecting        */ 
/* page loading.                                                */ 
/*--------------------------------------------------------------*/ 

/*------- Publisher Specific Section -------*/ 
$mm_placementid = 123456; 
$mm_adserver = "ads.mp.mydas.mobi"; 

/* The default response will be echo'd on the page     */
/* if no Ad is returned, so any valid WML/XHTML string */
/* is acceptable.                                      */
$mm_default_response = "";

/*------------------------------------------*/

/*----------- BEGIN AD INITIALIZATION ----------*/
/*----- PLEASE DO NOT EDIT BELOW THIS LINE -----*/
$mm_id = "NONE";
$mm_ua = "NONE";
@$mm_ip = $_SERVER['REMOTE_ADDR'];

if (isset($_SERVER['HTTP_USER_AGENT'] )){
     $mm_ua = $_SERVER['HTTP_USER_AGENT'];
}

if (isset($_SERVER['HTTP_X_UP_SUBNO'])) {
          $mm_id = $_SERVER['HTTP_X_UP_SUBNO'];
} elseif (isset($_SERVER['HTTP_XID'])) {
          $mm_id = $_SERVER['HTTP_XID'];
} elseif (isset($_SERVER['HTTP_CLIENTID'])) {
          $mm_id = $_SERVER['HTTP_CLIENTID'];
} else {
          $mm_id = $_SERVER['REMOTE_ADDR'];
}

$mm_url = "http://$mm_adserver/getAd.php5?apid=$mm_placementid&amp;auid="
          . urlencode($mm_id) . "&amp;uip=" . urlencode($mm_ip) . "&amp;ua="
          . urlencode($mm_ua);
/*------------ END AD INITIALIZATION -----------*/
?&gt;

&lt;?php
/* Place this code block where you want the ad to appear */
/*------- Reusable Ad Call -------*/
@$mm_response = file_get_contents($mm_url);
echo $mm_response != FALSE ? $mm_response : $mm_default_response;
/*--------- End Ad Call ----------*/
?&gt;
</code></pre>

<p>I want the Advertisement to appear in the footer area ( I will edit the footer.php in twenty eleven theme )
but I want to know where shall I put these pieces of codes in wordpress files or shall I create a new ones and what to name them?</p>

<p>would some please help me with this issue and provide me with the file's names that required to be edited and how would they look like in the end ?</p>

<p>Thanks</p>
