示例#1
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'GET';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://m2m1.inner-active.mobi/simpleM2M/clientRequestEnhancedHtmlAd';
         $http->addParam('aid', $network_ids['p_1']);
         $http->addParam('v', 'Sm2m-1.5.3');
         if ($request_info['main_device'] == 'IPHONE' or $request_info['main_device'] == 'IPOD TOUCH') {
             $http->addParam('po', '642');
         } else {
             if ($request_info['main_device'] == 'IPAD') {
                 $http->addParam('po', '947');
             } else {
                 if ($request_info['main_device'] == 'ANDROID') {
                     $http->addParam('po', '559');
                 } else {
                     $http->addParam('po', '551');
                 }
             }
         }
         $http->addParam('ua', $request_info['user_agent']);
         $http->addParam('cip', $request_info['ip_address']);
         if (isset($_GET['o'])) {
             $http->addParam('hid', md5($_GET['o']));
         }
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     if ($http->result == '' or !preg_match('<input type="hidden" id="inneractive-error" value="OK" />', $http->result)) {
         return false;
     }
     $ad = array();
     $ad['main_type'] = 'display';
     $ad['type'] = 'markup';
     $ad['click_url'] = '';
     $ad['html_markup'] = $ad['markup'];
     $ad['trackingpixel'] = '';
     $ad['image_url'] = '';
     $ad['clicktype'] = 'safari';
     $ad['skipoverlay'] = 1;
     $ad['skippreflight'] = 'yes';
     return $ad;
     //old below
     /*F:END*/
 }
示例#2
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     $httpConfig['method'] = 'GET';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://www.admoda.com/ads/fetch.php';
         $http->addParam('z', $network_ids['p_1']);
         $http->addParam('ua', $request_info['user_agent']);
         $http->addParam('a', $request_info['ip_address']);
         $http->addParam('v', '4');
         $http->addParam('l', 'php');
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     $response = $http->result;
     if ($response != '') {
         $banner = explode('|', $response);
         @($bannerid = $banner[0]);
         @($image_url = $banner[1]);
         @($click_url = $banner[2]);
         if ($bannerid && $image_url) {
             $ad = array();
             $ad['main_type'] = 'display';
             $ad['type'] = 'image-url';
             $ad['click_url'] = $click_url;
             $ad['trackingpixel'] = '';
             $ad['image_url'] = $image_url;
             $ad['clicktype'] = 'safari';
             $ad['skipoverlay'] = 0;
             $ad['skippreflight'] = 'yes';
             return $ad;
         } else {
             return false;
         }
     } else {
         return false;
     }
     /*F:END*/
 }
示例#3
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'POST';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://www.admanji.com/getAd.php';
         $http->addParam('s', $network_ids['p_1']);
         $http->addParam('ua', $request_info['user_agent']);
         $http->addParam('ra', $request_info['ip_address']);
         $http->addParam('b', '0');
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     if (preg_match("/href='([^']*)'/i", $http->result, $regs)) {
         $tempad['url'] = $regs[1];
     } else {
         if (preg_match('/href="([^"]*)"/i', $http->result, $regsx)) {
             $tempad['url'] = $regsx[1];
         } else {
             return false;
         }
     }
     $ad = array();
     $ad['main_type'] = 'display';
     $ad['type'] = 'markup';
     $ad['click_url'] = $tempad['url'];
     $ad['html_markup'] = $http->result;
     $ad['trackingpixel'] = '';
     $ad['image_url'] = '';
     $ad['clicktype'] = 'safari';
     $ad['skipoverlay'] = 0;
     $ad['skippreflight'] = 'yes';
     return $ad;
     /*F:END*/
 }
示例#4
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'POST';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://rq.vserv.mobi/delivery/adapi.php?';
         $http->addParam('zoneid', $network_ids['p_1']);
         $http->addParam('vr', '1.1.0-phpcurl-20100726');
         $http->addParam('ml', 'xhtml');
         $http->addParam('ip', $request_info['ip_address']);
         $http->addParam('ru', urlencode($request_info['referer']));
         $http->addParam('ua', $request_info['user_agent']);
         $http->addParam('tm', false);
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     if (preg_match("/href='([^']*)'/i", $http->result, $regs)) {
         $tempad['url'] = $regs[1];
     } else {
         if (preg_match('/href="([^"]*)"/i', $http->result, $regsx)) {
             $tempad['url'] = $regsx[1];
         } else {
             return false;
         }
     }
     $ad = array();
     $ad['main_type'] = 'display';
     $ad['type'] = 'markup';
     $ad['click_url'] = $tempad['url'];
     $ad['html_markup'] = $http->result;
     $ad['trackingpixel'] = '';
     $ad['image_url'] = '';
     $ad['clicktype'] = 'safari';
     $ad['skipoverlay'] = 0;
     $ad['skippreflight'] = 'yes';
     return $ad;
     /*F:END*/
 }
示例#5
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch JSON Exceptions*/
     $httpConfig['method'] = 'GET';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://show.buzzcity.net/showads.php';
         $http->addParam('partnerid', $network_ids['p_1']);
         $http->addParam('ua', $request_info['user_agent']);
         $http->addParam('ip', $request_info['ip_address']);
         if ($request_info['main_device'] == 'IPAD') {
             $http->addParam('get', 'tab');
         } else {
             $http->addParam('get', 'mweb');
         }
         $http->addParam('limit', 1);
         $http->addParam('wait', 0);
         if ($request_info['main_device'] == 'IPAD' or $request_info['main_device'] == 'IPHONE' or $request_info['main_device'] == 'IPOD TOUCH') {
             $http->addParam('browser', 'app_apple');
         } else {
             if ($request_info['main_device'] == 'ANDROID') {
                 $http->addParam('browser', 'app_android');
             }
         }
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     try {
         $json_response = json_decode($http->result);
     } catch (Exception $e) {
         // handle the error
         return false;
     }
     if (!empty($json_response->error->errmsg)) {
         return false;
     } else {
         if (isset($json_response->data[0]->campaign[0]->cid) && !empty($json_response->data[0]->campaign[0]->cid)) {
             $ad_temp['bc_show_url'] = $json_response->data[0]->url_show;
             $ad_temp['bc_click_url'] = $json_response->data[0]->url_click;
             $ad_temp['cid'] = $json_response->data[0]->campaign[0]->cid;
             $ad_temp['image'] = str_replace("\$cid", $ad_temp['cid'], $ad_temp['bc_show_url']);
             $ad_temp['url'] = str_replace("\$cid", $ad_temp['cid'], $ad_temp['bc_click_url']);
             $ad = array();
             $ad['main_type'] = 'display';
             $ad['type'] = 'image-url';
             $ad['click_url'] = $ad_temp['url'];
             $ad['trackingpixel'] = '';
             $ad['image_url'] = $ad_temp['image'];
             $ad['clicktype'] = 'safari';
             $ad['skipoverlay'] = 0;
             $ad['skippreflight'] = 'yes';
             return $ad;
         }
     }
     /*F:END*/
 }
示例#6
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     error_reporting(0);
     /*F:START*/
     $httpConfig['method'] = 'GET';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://a.zestadz.com/waphandler/deliverad';
         $http->addParam('cid', $network_ids['p_1']);
         $http->addParam('ua', $request_info['user_agent']);
         $http->addParam('response_type', 'xml');
         $http->addParam('ip', $request_info['ip_address']);
         $http->addParam('url', $request_info['referer']);
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     try {
         $xml_response = new SimpleXmlElement($http->result, LIBXML_NOCDATA);
     } catch (Exception $e) {
         // handle the error
         return false;
     }
     if ($xml_response['type'] == 'error') {
         return false;
     } else {
         if ($xml_response['type'] == 'picture' or $xml_response['type'] == 'text') {
             switch ($xml_response['type']) {
                 case 'picture':
                     $ad = array();
                     $ad['main_type'] = 'display';
                     $ad['type'] = 'image-url';
                     $ad['click_url'] = $xml_response->url;
                     $ad['trackingpixel'] = '';
                     $ad['image_url'] = $xml_response->picture;
                     $ad['clicktype'] = 'safari';
                     $ad['skipoverlay'] = 0;
                     $ad['skippreflight'] = 'yes';
                     return $ad;
                     break;
                 case 'text':
                     $ad = array();
                     $ad['main_type'] = 'display';
                     $ad['type'] = 'markup';
                     $ad['click_url'] = $xml_response->url;
                     $ad['html_markup'] = '<a href="' . $xml_response->url . '">' . $xml_response->text . '</a>';
                     $ad['trackingpixel'] = '';
                     $ad['image_url'] = '';
                     $ad['clicktype'] = 'safari';
                     $ad['skipoverlay'] = 0;
                     $ad['skippreflight'] = 'yes';
                     return $ad;
                     break;
             }
         } else {
             return false;
         }
     }
     /*F:END*/
 }
示例#7
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'POST';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://ads.mobgold.com/request.php';
         $http->addParam('ua', $request_info['user_agent']);
         $http->addParam('ipr', $request_info['ip_address']);
         $http->addParam('ipc', $request_info['ip_address']);
         $http->addParam('ref', $request_info['referer']);
         $http->addParam('uri', $request_info['referer']);
         $http->addParam('pt', 'http');
         $http->addParam('fmt', 'xml');
         $http->addParam('ver', '0.1.5');
         $http->addParam('sm', $network_ids['p_1']);
         $http->addParam('test', '1');
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     try {
         $xml_response = new SimpleXmlElement($http->result, LIBXML_NOCDATA);
     } catch (Exception $e) {
         // handle the error
         return false;
     }
     if (isset($xml_response->link)) {
         $tempad['url'] = $xml_response->link;
     } else {
         $tempad['url'] = '';
     }
     if (isset($xml_response->adtype)) {
         $tempad['type'] = $xml_response->adtype;
     } else {
         $tempad['type'] = '';
     }
     if (isset($xml_response->banner)) {
         $tempad['image'] = $xml_response->banner;
     } else {
         $tempad['image'] = '';
     }
     if (isset($xml_response->text)) {
         $tempad['text'] = $xml_response->text;
     } else {
         $tempad['text'] = '';
     }
     if ($tempad['url'] != '' && ($tempad['type'] == 1 or $tempad['type'] == 2)) {
         $ad = array();
         switch ($tempad['type']) {
             case 1:
                 $ad['main_type'] = 'display';
                 $ad['type'] = 'markup';
                 $ad['click_url'] = $tempad['url'];
                 $ad['html_markup'] = '<a href="' . $tempad['url'] . '">' . $tempad['text'] . '</a>';
                 $ad['trackingpixel'] = '';
                 $ad['image_url'] = '';
                 $ad['clicktype'] = 'safari';
                 $ad['skipoverlay'] = 0;
                 $ad['skippreflight'] = 'yes';
                 break;
             case 2:
                 $ad['main_type'] = 'display';
                 $ad['type'] = 'image-url';
                 $ad['click_url'] = $tempad['url'];
                 $ad['trackingpixel'] = '';
                 $ad['image_url'] = $tempad['image'];
                 $ad['clicktype'] = 'safari';
                 $ad['skipoverlay'] = 0;
                 $ad['skippreflight'] = 'yes';
                 break;
         }
         return $ad;
     } else {
         return false;
     }
     /*F:END*/
 }
示例#8
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'GET';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://a.jumptap.com/a/ads';
         $http->addParam('pub', $network_ids['p_1']);
         $http->addParam('site', $network_ids['p_2']);
         $http->addParam('spot', $network_ids['p_3']);
         $http->addParam('ua', $request_info['user_agent']);
         $http->addParam('gateway-ip', $request_info['ip_address']);
         $http->addParam('client-ip', $request_info['ip_address']);
         $http->addParam('v', 'v30');
         $http->addParam('l', 'en');
         $http->addParam('url', urlencode($request_info['referer']));
         if (isset($_GET['o'])) {
             $http->addParam('hid', $_GET['o']);
         } else {
             if (isset($_GET['o_mcsha1'])) {
                 $http->addParam('mac_sha1', md5($_GET['o_mcsha1']));
             }
         }
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     // GET AD LINK
     if (preg_match('/href="([^"]*)"/i', $http->result, $regs)) {
         $tempad['url'] = $regs[1];
     } else {
         $tempad['url'] = '';
     }
     // GET AD IMAGE URL
     if (preg_match('/src="([^"]*)"/i', $http->result, $regsa)) {
         $tempad['image'] = $regsa[1];
     } else {
         $tempad['image'] = '';
     }
     if ($tempad['url'] != "" && $tempad['image'] != "") {
         $ad = array();
         $ad['main_type'] = 'display';
         $ad['type'] = 'markup';
         $ad['click_url'] = $tempad['url'];
         $ad['html_markup'] = $http->result;
         $ad['trackingpixel'] = '';
         $ad['image_url'] = '';
         $ad['clicktype'] = 'safari';
         $ad['skipoverlay'] = 0;
         $ad['skippreflight'] = 'yes';
         return $ad;
     } else {
         return false;
     }
     /*F:END*/
 }
示例#9
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'GET';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://r.tapit.com/adrequest.php';
         $http->addParam('zone', $network_ids['p_1']);
         $http->addParam('ip', $request_info['ip_address']);
         $http->addParam('ua', $request_info['user_agent']);
         if (isset($_GET['o'])) {
             $http->addParam('udid', md5($_GET['o']));
         } else {
             if (isset($_GET['o_mcsha1'])) {
                 $http->addParam('udid', md5($_GET['o_mcsha1']));
             } else {
                 if (isset($_GET['o_mcmd5'])) {
                     $http->addParam('udid', md5($_GET['o_mcmd5']));
                 } else {
                     if (isset($_GET['o_openudid'])) {
                         $http->addParam('udid', md5($_GET['o_openudid']));
                     }
                 }
             }
         }
         $http->addParam('format', 'json');
         $http->addParam('long', $request_info['longitude']);
         $http->addParam('lat', $request_info['latitude']);
         $http->addParam('h', $zone_detail['zone_height']);
         $http->addParam('w', $zone_detail['zone_width']);
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     try {
         $json_response = json_decode($http->result);
     } catch (Exception $e) {
         // handle the error
         return false;
     }
     if (isset($json_response->imageurl)) {
         $tempad['image'] = $json_response->imageurl;
     } else {
         $tempad['image'] = '';
     }
     if (isset($json_response->clickurl)) {
         $tempad['url'] = $json_response->clickurl;
     } else {
         $tempad['url'] = '';
     }
     if (isset($json_response->type)) {
         $tempad['type'] = $json_response->type;
     } else {
         $tempad['type'] = '';
     }
     if (isset($json_response->adtext)) {
         $tempad['text'] = $json_response->adtext;
     } else {
         $tempad['text'] = '';
     }
     if ($request_type == 'banner') {
         if ($tempad['type'] == 'banner') {
             $ad = array();
             $ad['main_type'] = 'display';
             $ad['type'] = 'image-url';
             $ad['click_url'] = $tempad['url'];
             $ad['trackingpixel'] = '';
             $ad['image_url'] = $tempad['image'];
             $ad['clicktype'] = 'safari';
             $ad['skipoverlay'] = 0;
             $ad['skippreflight'] = 'yes';
             return $ad;
         } else {
             if ($tempad['type'] == 'text') {
                 $ad = array();
                 $ad['main_type'] = 'display';
                 $ad['type'] = 'markup';
                 $ad['click_url'] = $tempad['url'];
                 $ad['html_markup'] = '<a href="' . $tempad['url'] . '">' . $tempad['text'] . '</a>';
                 $ad['trackingpixel'] = '';
                 $ad['image_url'] = '';
                 $ad['clicktype'] = 'safari';
                 $ad['skipoverlay'] = 0;
                 $ad['skippreflight'] = 'yes';
                 return $ad;
             } else {
                 return false;
             }
         }
     } else {
         return false;
     }
     /*F:END*/
 }
示例#10
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'GET';
     $httpConfig['timeout'] = '1';
     $randomnumber = sha1(rand(1, 500000));
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://ro.plus1.wapstart.ru';
         $http->addParam('area', 'viewBannerXml');
         $http->addParam('site', $network_ids['p_1']);
         $http->addParam('position', '1');
         $http->addParam('markup', '2');
         $http->addParam('userAgent', $request_info['user_agent']);
         $http->addParam('ip', $request_info['ip_address']);
         $http->addParam('tplVersion', '2');
         $http->addParam('pageId', $randomnumber);
         if (isset($_GET['o'])) {
             $http->addParam('clientSession', sha1($_GET['o']));
         } else {
             if (isset($_GET['o_mcsha1'])) {
                 $http->addParam('clientSession', sha1($_GET['o_mcsha1']));
             }
         }
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     if ($http->result == "<!-- i4jgij4pfd4ssd -->") {
         return false;
     }
     try {
         $xml_response = new SimpleXmlElement($http->result, LIBXML_NOCDATA);
     } catch (Exception $e) {
         // handle the error
         return false;
     }
     $tempad['content'] = $xml_response->content;
     $tempad['title'] = $xml_response->title;
     $tempad['url'] = $xml_response->link;
     $tempad['singlelinecontent'] = $xml_response->singleLineContent;
     $tempad['imageurl'] = $xml_response->pictureUrl;
     // START AD URL NOT EMPTY
     if ($tempad['url'] != "") {
         if ($tempad['imageurl'] != "") {
             $ad = array();
             $ad['main_type'] = 'display';
             $ad['type'] = 'image-url';
             $ad['click_url'] = $tempad['url'];
             $ad['trackingpixel'] = '';
             $ad['image_url'] = $tempad['imageurl'];
             $ad['clicktype'] = 'safari';
             $ad['skipoverlay'] = 0;
             $ad['skippreflight'] = 'yes';
             return $ad;
         } else {
             if (strlen($tempad['imageurl']) < 3 && $tempad['singlelinecontent'] != "") {
                 $ad['main_type'] = 'display';
                 $ad['type'] = 'markup';
                 $ad['click_url'] = $tempad['url'];
                 $ad['html_markup'] = '<a href="' . $tempad['url'] . '">' . $tempad['singlelinecontent'] . '</a>';
                 $ad['trackingpixel'] = '';
                 $ad['image_url'] = '';
                 $ad['clicktype'] = 'safari';
                 $ad['skipoverlay'] = 0;
                 $ad['skippreflight'] = 'yes';
             } else {
                 if (strlen($tempad['imageurl']) < 3 && $tempad['title'] != "") {
                     $ad['main_type'] = 'display';
                     $ad['type'] = 'markup';
                     $ad['click_url'] = $tempad['url'];
                     $ad['html_markup'] = '<a href="' . $tempad['url'] . '">' . $tempad['title'] . ' - ' . $tempad['content'] . '</a>';
                     $ad['trackingpixel'] = '';
                     $ad['image_url'] = '';
                     $ad['clicktype'] = 'safari';
                     $ad['skipoverlay'] = 0;
                     $ad['skippreflight'] = 'yes';
                 } else {
                     return false;
                 }
             }
         }
     } else {
         return false;
     }
     /*F:END*/
 }
示例#11
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'POST';
     $httpConfig['timeout'] = 1;
     $httpConfig['special'] = 'INMOBI';
     $httpConfig['inmobisiteid'] = $network_ids['p_1'];
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner' or $request_type == 'interstitial') {
         $request_url = 'http://w.inmobi.com/showad.asm';
         $http->addParam('mk-siteid', $network_ids['p_1']);
         $http->addParam('mk-carrier', $request_info['ip_address']);
         $http->addParam('h-user-agent', $request_info['user_agent']);
         $http->addParam('mk-version', 'pr-SPEC-ATATA-20090521');
         $http->addParam('h-page-url', $request_info['referer']);
         $http->addParam('format', 'axml');
         if ($request_type == 'interstitial') {
             if ($request_info['main_device'] == 'IPAD') {
                 $http->addParam('mk-ad-slot', '16');
             } else {
                 $http->addParam('mk-ad-slot', '14');
             }
         } else {
             /*Zone Size Identification*/
             if ($zone_detail['zone_width'] == '300' && $zone_detail['zone_height'] == '250') {
                 $http->addParam('mk-ad-slot', '10');
             } else {
                 if ($zone_detail['zone_width'] == '728' && $zone_detail['zone_height'] == '90') {
                     $http->addParam('mk-ad-slot', '11');
                 } else {
                     if ($zone_detail['zone_width'] == '468' && $zone_detail['zone_height'] == '60') {
                         $http->addParam('mk-ad-slot', '12');
                     } else {
                         if ($zone_detail['zone_width'] == '120' && $zone_detail['zone_height'] == '600') {
                             $http->addParam('mk-ad-slot', '13');
                         } else {
                             if ($zone_detail['zone_width'] == '320' && $zone_detail['zone_height'] == '480') {
                                 $http->addParam('mk-ad-slot', '14');
                             } else {
                                 if ($zone_detail['zone_width'] == '1024' && $zone_detail['zone_height'] == '768') {
                                     $http->addParam('mk-ad-slot', '16');
                                 } else {
                                     if ($zone_detail['zone_width'] == '1280' && $zone_detail['zone_height'] == '800') {
                                         $http->addParam('mk-ad-slot', '17');
                                     } else {
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             /*END: Zone Size Identification*/
         }
         if (isset($_GET['rt']) && ($_GET['rt'] == 'iphone_app' or $_GET['rt'] == 'android_app' or $_GET['rt'] == 'ipad_app')) {
             if (isset($_GET['o'])) {
                 $http->addParam('u-id', $_GET['o']);
             }
             $http->addParam('d-localization', 'en_US');
             $http->addParam('d-netType', 'WiFi');
         }
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     if ($http->result == '' or preg_match("<!-- mKhoj: No advt for this position -->", $http->result)) {
         return false;
     }
     try {
         $xml_response = new SimpleXmlElement($http->result, LIBXML_NOCDATA);
     } catch (Exception $e) {
         // handle the error
         return false;
     }
     if (isset($xml_response->Ads->Ad['type'])) {
         $tempad['type'] = $xml_response->Ads->Ad['type'];
     } else {
         $tempad['type'] = '';
     }
     if (isset($xml_response->Ads->Ad)) {
         $tempad['markup'] = $xml_response->Ads->Ad;
     } else {
         $tempad['markup'] = '';
     }
     if (isset($xml_response->Ads->Ad->AdURL)) {
         $tempad['url'] = $xml_response->Ads->Ad->AdURL;
     } else {
         $tempad['url'] = '';
     }
     if ($tempad['url'] == 'null' or $tempad['url'] == '') {
         return false;
     }
     if ($request_type == 'banner') {
         if ($tempad['type'] == 'banner' or $tempad['type'] == 'text') {
             $ad = array();
             $ad['main_type'] = 'display';
             $ad['type'] = 'markup';
             $ad['click_url'] = $tempad['url'];
             $ad['html_markup'] = $tempad['markup'];
             $ad['trackingpixel'] = '';
             $ad['image_url'] = '';
             $ad['clicktype'] = 'safari';
             $ad['skipoverlay'] = 0;
             $ad['skippreflight'] = 'yes';
             return $ad;
         } else {
             if ($tempad['type'] == 'rm') {
                 $ad = array();
                 $ad['main_type'] = 'display';
                 $ad['type'] = 'mraid-markup';
                 $ad['click_url'] = $tempad['url'];
                 $ad['html_markup'] = $tempad['markup'];
                 $ad['trackingpixel'] = '';
                 $ad['image_url'] = '';
                 $ad['clicktype'] = 'safari';
                 $ad['skipoverlay'] = 0;
                 $ad['skippreflight'] = 'yes';
                 return $ad;
             } else {
                 return false;
             }
         }
     } else {
         if ($request_type == 'interstitial') {
             if ($tempad['type'] == 'banner' or $tempad['type'] == 'text') {
                 $ad = array();
                 $ad['main_type'] = 'interstitial';
                 $ad['type'] = 'interstitial';
                 $ad['animation'] = 'None';
                 /* Interstitial */
                 $ad['interstitial-orientation'] = 'portrait';
                 $ad['interstitial-preload'] = 0;
                 $ad['interstitial-autoclose'] = 0;
                 $ad['interstitial-type'] = 'markup';
                 $ad['interstitial-content'] = $tempad['markup'];
                 $ad['interstitial-skipbutton-show'] = 1;
                 $ad['interstitial-skipbutton-showafter'] = 0;
                 $ad['interstitial-navigation-show'] = 0;
                 $ad['interstitial-navigation-topbar-show'] = 0;
                 $ad['interstitial-navigation-bottombar-show'] = 0;
                 $ad['interstitial-navigation-topbar-custombg'] = '';
                 $ad['interstitial-navigation-bottombar-custombg'] = '';
                 $ad['interstitial-navigation-topbar-titletype'] = 'fixed';
                 $ad['interstitial-navigation-topbar-titlecontent'] = '';
                 $ad['interstitial-navigation-bottombar-backbutton'] = 0;
                 $ad['interstitial-navigation-bottombar-forwardbutton'] = 0;
                 $ad['interstitial-navigation-bottombar-reloadbutton'] = 0;
                 $ad['interstitial-navigation-bottombar-externalbutton'] = 0;
                 $ad['interstitial-navigation-bottombar-timer'] = 0;
                 /* Interstitial */
                 return $ad;
             } else {
                 return false;
             }
         } else {
             return false;
         }
     }
     /*F:END*/
 }
示例#12
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch JSON Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'GET';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://0000-0000-0000-0000.reporo.net/api';
         $http->addParam('z', $network_ids['p_1']);
         $http->addParam('ua', $request_info['user_agent']);
         $http->addParam('ip', $request_info['ip_address']);
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     try {
         $json_response = json_decode($http->result);
     } catch (Exception $e) {
         // handle the error
         return false;
     }
     if (isset($json_response->bannerurl)) {
         $tempad['image'] = $json_response->bannerurl;
     } else {
         $tempad['image'] = '';
     }
     if (isset($json_response->url)) {
         $tempad['url'] = $json_response->url;
     } else {
         $tempad['url'] = '';
     }
     if (isset($json_response->adtext)) {
         $tempad['text'] = $json_response->adtext;
     } else {
         $tempad['text'] = '';
     }
     if ($request_type == 'banner') {
         if ($tempad['image'] != '' && $tempad['url'] != '') {
             $ad = array();
             $ad['main_type'] = 'display';
             $ad['type'] = 'image-url';
             $ad['click_url'] = $tempad['url'];
             $ad['trackingpixel'] = '';
             $ad['image_url'] = $tempad['image'];
             $ad['clicktype'] = 'safari';
             $ad['skipoverlay'] = 0;
             $ad['skippreflight'] = 'yes';
             return $ad;
         } else {
             if ($tempad['text'] != '' && $tempad['url'] != '') {
                 $ad = array();
                 $ad['main_type'] = 'display';
                 $ad['type'] = 'markup';
                 $ad['click_url'] = $tempad['url'];
                 $ad['html_markup'] = '<a href="' . $tempad['url'] . '">' . $tempad['text'] . '</a>';
                 $ad['trackingpixel'] = '';
                 $ad['image_url'] = '';
                 $ad['clicktype'] = 'safari';
                 $ad['skipoverlay'] = 0;
                 $ad['skippreflight'] = 'yes';
                 return $ad;
             } else {
                 return false;
             }
         }
     } else {
         return false;
     }
     /*F:END*/
 }
示例#13
0
function mf_add_publication_call($zone_id)
{
    $zone_detail = get_zone_detail($zone_id);
    $publication_detail = get_publication_detail($zone_detail['publication_id']);
    // Include the Http Class
    require_once MAD_PATH . '/modules/http/class.http.php';
    // Instantiate it
    $http = new Http();
    $http->addParam('action', 'add_publication');
    $http->addParam('uid', getconfig_var('mobfox_uid'));
    $http->addParam('pass', getconfig_var('mobfox_password'));
    $http->addParam('inv_name', $publication_detail['inv_name'] . ' ' . $zone_detail['zone_name']);
    $http->addParam('inv_desc', $publication_detail['inv_description'] . ' ' . $zone_detail['zone_description']);
    $http->addParam('inv_url', $publication_detail['inv_address']);
    $http->addParam('inv_type', $publication_detail['inv_type']);
    $http->addParam('inv_cat', get_zone_channel($zone_id));
    $http->execute('http://api.mobfox.com/api_madserve.php');
    if ($http->error) {
        return false;
    }
    if (!validate_md5($http->result)) {
        return false;
    }
    update_publisher_id(0, 'MOBFOX', $publication_detail['inv_id'], $zone_id, $http->result, '', '', '');
    return true;
}
示例#14
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $http = new Http();
     if ($request_type == 'banner') {
         $request_url = 'http://my.mobfox.com/request.php';
         $http->addParam('rt', 'api');
         $http->addParam('r_madserve', 1);
         $http->addParam('m', 'live');
         $http->addParam('s', $network_ids['p_1']);
         $http->addParam('u', $request_info['user_agent']);
         $http->addParam('i', $request_info['ip_address']);
         $http->addParam('p', $request_info['referer']);
         $http->addParam('longitude', $request_info['longitude']);
         $http->addParam('latitude', $request_info['latitude']);
         $http->addParam('adspace.height', $zone_detail['zone_height']);
         $http->addParam('adspace.width', $zone_detail['zone_width']);
         if (isset($_GET['demo.gender'])) {
             $http->addParam('demo.gender', $_GET['demo.gender']);
         }
         if (isset($_GET['demo.keywords'])) {
             $http->addParam('demo.keywords', $_GET['demo.keywords']);
         }
         if (isset($_GET['demo.age'])) {
             $http->addParam('demo.age', $_GET['demo.age']);
         }
         if (isset($_GET['o'])) {
             $http->addParam('o', $_GET['o']);
         }
         if (isset($_GET['v'])) {
             $http->addParam('v', $_GET['v']);
         }
         if (isset($_GET['o_mcsha1'])) {
             $http->addParam('o_mcsha1', $_GET['o_mcsha1']);
         }
         if (isset($_GET['o_mcmd5'])) {
             $http->addParam('o_mcmd5', $_GET['o_mcmd5']);
         }
         if (isset($_GET['o_openudid'])) {
             $http->addParam('o_openudid', $_GET['o_openudid']);
         }
         if (isset($_GET['o_iosadvid'])) {
             $http->addParam('o_iosadvid', $_GET['o_iosadvid']);
         }
         if (isset($_GET['c.mraid'])) {
             $http->addParam('c.mraid', $_GET['c.mraid']);
         }
         if ($backfill == 1) {
             global $zone_detail;
             if ($zone_detail['mobfox_min_cpc_active'] == 1 && $zone_detail['min_cpc'] > 0) {
                 $http->addParam('apiset[min_cpc_active]', 1);
                 $http->addParam('apiset[min_cpc]', $zone_detail['min_cpc']);
             }
             if ($zone_detail['mobfox_min_cpc_active'] == 1 && $zone_detail['min_cpm'] > 0) {
                 $http->addParam('apiset[min_cpm_active]', 1);
                 $http->addParam('apiset[min_cpm]', $zone_detail['min_cpm']);
             }
         }
     } else {
         if ($request_type == 'interstitial') {
             $request_url = 'http://my.mobfox.com/vrequest.php';
             $http->addParam('rt', 'api');
             $http->addParam('r_madserve', 1);
             $http->addParam('m', 'live');
             $http->addParam('s', $network_ids['p_1']);
             $http->addParam('u', $request_info['user_agent']);
             $http->addParam('i', $request_info['ip_address']);
             $http->addParam('p', $request_info['referer']);
             $http->addParam('longitude', $request_info['longitude']);
             $http->addParam('latitude', $request_info['latitude']);
             if (isset($_GET['demo.gender'])) {
                 $http->addParam('demo.gender', $_GET['demo.gender']);
             }
             if (isset($_GET['demo.keywords'])) {
                 $http->addParam('demo.keywords', $_GET['demo.keywords']);
             }
             if (isset($_GET['demo.age'])) {
                 $http->addParam('demo.age', $_GET['demo.age']);
             }
             if (isset($_GET['o'])) {
                 $http->addParam('o', $_GET['o']);
             }
             if (isset($_GET['v'])) {
                 $http->addParam('v', $_GET['v']);
             }
             if (isset($_GET['o_mcsha1'])) {
                 $http->addParam('o_mcsha1', $_GET['o_mcsha1']);
             }
             if (isset($_GET['o_mcmd5'])) {
                 $http->addParam('o_mcmd5', $_GET['o_mcmd5']);
             }
             if (isset($_GET['o_openudid'])) {
                 $http->addParam('o_openudid', $_GET['o_openudid']);
             }
             if (isset($_GET['o_iosadvid'])) {
                 $http->addParam('o_iosadvid', $_GET['o_iosadvid']);
             }
             if (isset($_GET['c.mraid'])) {
                 $http->addParam('c.mraid', $_GET['c.mraid']);
             }
         } else {
             return false;
         }
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     try {
         $xml_response = new SimpleXmlElement($http->result, LIBXML_NOCDATA);
     } catch (Exception $e) {
         // handle the error
         return false;
     }
     if ($request_type == 'banner') {
         if ($xml_response['type'] == 'textAd') {
             $ad = array();
             $ad['main_type'] = 'display';
             $ad['type'] = 'markup';
             $ad['click_url'] = $xml_response->clickurl;
             $ad['html_markup'] = $xml_response->htmlString;
             $ad['trackingpixel'] = '';
             $ad['image_url'] = '';
             $ad['clicktype'] = $xml_response->clicktype;
             $ad['refresh'] = $xml_response->refresh;
             $ad['skipoverlay'] = $xml_response->htmlString['skipoverlaybutton'];
             $ad['skippreflight'] = $xml_response->skippreflight;
             return $ad;
         } else {
             if ($xml_response['type'] == 'mraidAd') {
                 $ad = array();
                 $ad['main_type'] = 'display';
                 $ad['type'] = 'mraid-markup';
                 $ad['click_url'] = $xml_response->clickurl;
                 $ad['html_markup'] = $xml_response->htmlString;
                 $ad['trackingpixel'] = '';
                 $ad['image_url'] = '';
                 $ad['clicktype'] = $xml_response->clicktype;
                 $ad['refresh'] = $xml_response->refresh;
                 $ad['skipoverlay'] = $xml_response->htmlString['skipoverlaybutton'];
                 $ad['skippreflight'] = $xml_response->skippreflight;
                 return $ad;
             } else {
                 return false;
             }
         }
     } else {
         if ($request_type == 'interstitial') {
             if ($xml_response['type'] == 'video') {
                 $ad = array();
                 $ad['main_type'] = 'interstitial';
                 $ad['type'] = 'video';
                 $ad['animation'] = $xml_response['animation'];
                 /* Video */
                 $ad['video-orientation'] = $xml_response->video['orientation'];
                 $ad['video-expiration'] = $xml_response->video['expiration'];
                 $ad['video-creative-display'] = $xml_response->video->creative['display'];
                 $ad['video-creative-delivery'] = $xml_response->video->creative['delivery'];
                 $ad['video-creative-type'] = $xml_response->video->creative['type'];
                 $ad['video-creative-bitrate'] = $xml_response->video->creative['bitrate'];
                 $ad['video-creative-width'] = $xml_response->video->creative['width'];
                 $ad['video-creative-height'] = $xml_response->video->creative['height'];
                 $ad['video-creative-url'] = $xml_response->video->creative;
                 $ad['video-duration'] = $xml_response->video->duration;
                 $ad['video-skipbutton-show'] = $xml_response->video->skipbutton['show'];
                 $ad['video-skipbutton-showafter'] = $xml_response->video->skipbutton['showafter'];
                 $ad['video-navigation-show'] = $xml_response->video->navigation['show'];
                 $ad['video-navigation-allowtap'] = $xml_response->video->navigation['allowtap'];
                 $ad['video-navigation-topbar-show'] = $xml_response->video->navigation->topbar['show'];
                 $ad['video-navigation-bottombar-show'] = $xml_response->video->navigation->bottombar['show'];
                 $ad['video-navigation-topbar-custombg'] = $xml_response->video->navigation->topbar['custombackgroundurl'];
                 $ad['video-navigation-bottombar-custombg'] = $xml_response->video->navigation->bottombar['custombackgroundurl'];
                 $ad['video-navigation-bottombar-pausebutton'] = $xml_response->video->navigation->bottombar['pausebutton'];
                 $ad['video-navigation-bottombar-replaybutton'] = $xml_response->video->navigation->bottombar['replaybutton'];
                 $ad['video-navigation-bottombar-timer'] = $xml_response->video->navigation->bottombar['timer'];
                 $ad['video-trackers'] = array();
                 foreach ($xml_response->video->trackingevents->tracker as $video_tracker) {
                     $tracker_type = $video_tracker['type'];
                     $tracker_url = $video_tracker;
                     $xadd = array($tracker_type, $tracker_url);
                     array_push($ad['video-trackers'], $xadd);
                 }
                 $ad['video-htmloverlay-show'] = $xml_response->video->htmloverlay['show'];
                 $ad['video-htmloverlay-showafter'] = $xml_response->video->htmloverlay['showafter'];
                 $ad['video-htmloverlay-type'] = $xml_response->video->htmloverlay['type'];
                 if ($ad['video-htmloverlay-type'] == 'url') {
                     $ad['video-htmloverlay-content'] = $xml_response->video->htmloverlay['url'];
                 }
                 if ($ad['video-htmloverlay-type'] == 'markup') {
                     $ad['video-htmloverlay-content'] = $xml_response->video->htmloverlay;
                 }
                 return $ad;
                 /* Video */
             } else {
                 if ($xml_response['type'] == 'interstitial') {
                     $ad = array();
                     $ad['main_type'] = 'interstitial';
                     $ad['type'] = 'interstitial';
                     $ad['animation'] = $xml_response['animation'];
                     /* Interstitial */
                     $ad['interstitial-orientation'] = $xml_response->interstitial['orientation'];
                     $ad['interstitial-preload'] = $xml_response->interstitial['preload'];
                     $ad['interstitial-autoclose'] = $xml_response->interstitial['autoclose'];
                     $ad['interstitial-type'] = $xml_response->interstitial['type'];
                     if ($ad['interstitial-type'] == 'url') {
                         $ad['interstitial-content'] = $xml_response->interstitial['url'];
                     } else {
                         if ($ad['interstitial-type'] == 'markup') {
                             $ad['interstitial-content'] = $xml_response->interstitial->markup;
                         }
                     }
                     $ad['interstitial-skipbutton-show'] = $xml_response->interstitial->skipbutton['show'];
                     $ad['interstitial-skipbutton-showafter'] = $xml_response->interstitial->skipbutton['showafter'];
                     $ad['interstitial-navigation-show'] = $xml_response->interstitial->navigation['show'];
                     $ad['interstitial-navigation-topbar-show'] = $xml_response->interstitial->navigation->topbar['show'];
                     $ad['interstitial-navigation-bottombar-show'] = $xml_response->interstitial->navigation->bottombar['show'];
                     $ad['interstitial-navigation-topbar-custombg'] = $xml_response->interstitial->navigation->topbar['custombackgroundurl'];
                     $ad['interstitial-navigation-bottombar-custombg'] = $xml_response->interstitial->navigation->bottombar['custombackgroundurl'];
                     $ad['interstitial-navigation-topbar-titletype'] = $xml_response->interstitial->navigation->topbar['title'];
                     $ad['interstitial-navigation-topbar-titlecontent'] = $xml_response->interstitial->navigation->topbar['titlecontent'];
                     $ad['interstitial-navigation-bottombar-backbutton'] = $xml_response->interstitial->navigation->bottombar['backbutton'];
                     $ad['interstitial-navigation-bottombar-forwardbutton'] = $xml_response->interstitial->navigation->bottombar['forwardbutton'];
                     $ad['interstitial-navigation-bottombar-reloadbutton'] = $xml_response->interstitial->navigation->bottombar['reloadbutton'];
                     $ad['interstitial-navigation-bottombar-externalbutton'] = $xml_response->interstitial->navigation->bottombar['externalbutton'];
                     $ad['interstitial-navigation-bottombar-timer'] = $xml_response->interstitial->navigation->bottombar['timer'];
                     /* Interstitial */
                     return $ad;
                 } else {
                     if ($xml_response['type'] == 'interstitial-to-video') {
                         $ad = array();
                         $ad['main_type'] = 'interstitial';
                         $ad['type'] = 'interstitial-video';
                         $ad['animation'] = $xml_response['animation'];
                         /* Interstitial */
                         $ad['interstitial-orientation'] = $xml_response->interstitial['orientation'];
                         $ad['interstitial-preload'] = $xml_response->interstitial['preload'];
                         $ad['interstitial-autoclose'] = $xml_response->interstitial['autoclose'];
                         $ad['interstitial-type'] = $xml_response->interstitial['type'];
                         if ($ad['interstitial-type'] == 'url') {
                             $ad['interstitial-content'] = $xml_response->interstitial['url'];
                         } else {
                             if ($ad['interstitial-type'] == 'markup') {
                                 $ad['interstitial-content'] = $xml_response->interstitial->markup;
                             }
                         }
                         $ad['interstitial-skipbutton-show'] = $xml_response->interstitial->skipbutton['show'];
                         $ad['interstitial-skipbutton-showafter'] = $xml_response->interstitial->skipbutton['showafter'];
                         $ad['interstitial-navigation-show'] = $xml_response->interstitial->navigation['show'];
                         $ad['interstitial-navigation-topbar-show'] = $xml_response->interstitial->navigation->topbar['show'];
                         $ad['interstitial-navigation-bottombar-show'] = $xml_response->interstitial->navigation->bottombar['show'];
                         $ad['interstitial-navigation-topbar-custombg'] = $xml_response->interstitial->navigation->topbar['custombackgroundurl'];
                         $ad['interstitial-navigation-bottombar-custombg'] = $xml_response->interstitial->navigation->bottombar['custombackgroundurl'];
                         $ad['interstitial-navigation-topbar-titletype'] = $xml_response->interstitial->navigation->topbar['title'];
                         $ad['interstitial-navigation-topbar-titlecontent'] = $xml_response->interstitial->navigation->topbar['titlecontent'];
                         $ad['interstitial-navigation-bottombar-backbutton'] = $xml_response->interstitial->navigation->bottombar['backbutton'];
                         $ad['interstitial-navigation-bottombar-forwardbutton'] = $xml_response->interstitial->navigation->bottombar['forwardbutton'];
                         $ad['interstitial-navigation-bottombar-reloadbutton'] = $xml_response->interstitial->navigation->bottombar['reloadbutton'];
                         $ad['interstitial-navigation-bottombar-externalbutton'] = $xml_response->interstitial->navigation->bottombar['externalbutton'];
                         $ad['interstitial-navigation-bottombar-timer'] = $xml_response->interstitial->navigation->bottombar['timer'];
                         /* Interstitial */
                         /* Video */
                         $ad['video-orientation'] = $xml_response->video['orientation'];
                         $ad['video-expiration'] = $xml_response->video['expiration'];
                         $ad['video-creative-display'] = $xml_response->video->creative['display'];
                         $ad['video-creative-delivery'] = $xml_response->video->creative['delivery'];
                         $ad['video-creative-type'] = $xml_response->video->creative['type'];
                         $ad['video-creative-bitrate'] = $xml_response->video->creative['bitrate'];
                         $ad['video-creative-width'] = $xml_response->video->creative['width'];
                         $ad['video-creative-height'] = $xml_response->video->creative['height'];
                         $ad['video-creative-url'] = $xml_response->video->creative;
                         $ad['video-duration'] = $xml_response->video->duration;
                         $ad['video-skipbutton-show'] = $xml_response->video->skipbutton['show'];
                         $ad['video-skipbutton-showafter'] = $xml_response->video->skipbutton['showafter'];
                         $ad['video-navigation-show'] = $xml_response->video->navigation['show'];
                         $ad['video-navigation-allowtap'] = $xml_response->video->navigation['allowtap'];
                         $ad['video-navigation-topbar-show'] = $xml_response->video->navigation->topbar['show'];
                         $ad['video-navigation-bottombar-show'] = $xml_response->video->navigation->bottombar['show'];
                         $ad['video-navigation-topbar-custombg'] = $xml_response->video->navigation->topbar['custombackgroundurl'];
                         $ad['video-navigation-bottombar-custombg'] = $xml_response->video->navigation->bottombar['custombackgroundurl'];
                         $ad['video-navigation-bottombar-pausebutton'] = $xml_response->video->navigation->bottombar['pausebutton'];
                         $ad['video-navigation-bottombar-replaybutton'] = $xml_response->video->navigation->bottombar['replaybutton'];
                         $ad['video-navigation-bottombar-timer'] = $xml_response->video->navigation->bottombar['timer'];
                         $ad['video-trackers'] = array();
                         foreach ($xml_response->video->trackingevents->tracker as $video_tracker) {
                             $tracker_type = $video_tracker['type'];
                             $tracker_url = $video_tracker;
                             $xadd = array($tracker_type, $tracker_url);
                             array_push($ad['video-trackers'], $xadd);
                         }
                         $ad['video-htmloverlay-show'] = $xml_response->video->htmloverlay['show'];
                         $ad['video-htmloverlay-showafter'] = $xml_response->video->htmloverlay['showafter'];
                         $ad['video-htmloverlay-type'] = $xml_response->video->htmloverlay['type'];
                         if ($ad['video-htmloverlay-type'] == 'url') {
                             $ad['video-htmloverlay-content'] = $xml_response->video->htmloverlay['url'];
                         }
                         if ($ad['video-htmloverlay-type'] == 'markup') {
                             $ad['video-htmloverlay-content'] = $xml_response->video->htmloverlay;
                         }
                         /* Video */
                         return $ad;
                     } else {
                         if ($xml_response['type'] == 'video-to-interstitial') {
                             $ad = array();
                             $ad['main_type'] = 'interstitial';
                             $ad['type'] = 'video-interstitial';
                             $ad['animation'] = $xml_response['animation'];
                             /* Interstitial */
                             $ad['interstitial-orientation'] = $xml_response->interstitial['orientation'];
                             $ad['interstitial-preload'] = $xml_response->interstitial['preload'];
                             $ad['interstitial-autoclose'] = $xml_response->interstitial['autoclose'];
                             $ad['interstitial-type'] = $xml_response->interstitial['type'];
                             if ($ad['interstitial-type'] == 'url') {
                                 $ad['interstitial-content'] = $xml_response->interstitial['url'];
                             } else {
                                 if ($ad['interstitial-type'] == 'markup') {
                                     $ad['interstitial-content'] = $xml_response->interstitial->markup;
                                 }
                             }
                             $ad['interstitial-skipbutton-show'] = $xml_response->interstitial->skipbutton['show'];
                             $ad['interstitial-skipbutton-showafter'] = $xml_response->interstitial->skipbutton['showafter'];
                             $ad['interstitial-navigation-show'] = $xml_response->interstitial->navigation['show'];
                             $ad['interstitial-navigation-topbar-show'] = $xml_response->interstitial->navigation->topbar['show'];
                             $ad['interstitial-navigation-bottombar-show'] = $xml_response->interstitial->navigation->bottombar['show'];
                             $ad['interstitial-navigation-topbar-custombg'] = $xml_response->interstitial->navigation->topbar['custombackgroundurl'];
                             $ad['interstitial-navigation-bottombar-custombg'] = $xml_response->interstitial->navigation->bottombar['custombackgroundurl'];
                             $ad['interstitial-navigation-topbar-titletype'] = $xml_response->interstitial->navigation->topbar['title'];
                             $ad['interstitial-navigation-topbar-titlecontent'] = $xml_response->interstitial->navigation->topbar['titlecontent'];
                             $ad['interstitial-navigation-bottombar-backbutton'] = $xml_response->interstitial->navigation->bottombar['backbutton'];
                             $ad['interstitial-navigation-bottombar-forwardbutton'] = $xml_response->interstitial->navigation->bottombar['forwardbutton'];
                             $ad['interstitial-navigation-bottombar-reloadbutton'] = $xml_response->interstitial->navigation->bottombar['reloadbutton'];
                             $ad['interstitial-navigation-bottombar-externalbutton'] = $xml_response->interstitial->navigation->bottombar['externalbutton'];
                             $ad['interstitial-navigation-bottombar-timer'] = $xml_response->interstitial->navigation->bottombar['timer'];
                             /* Interstitial */
                             /* Video */
                             $ad['video-orientation'] = $xml_response->video['orientation'];
                             $ad['video-expiration'] = $xml_response->video['expiration'];
                             $ad['video-creative-display'] = $xml_response->video->creative['display'];
                             $ad['video-creative-delivery'] = $xml_response->video->creative['delivery'];
                             $ad['video-creative-type'] = $xml_response->video->creative['type'];
                             $ad['video-creative-bitrate'] = $xml_response->video->creative['bitrate'];
                             $ad['video-creative-width'] = $xml_response->video->creative['width'];
                             $ad['video-creative-height'] = $xml_response->video->creative['height'];
                             $ad['video-creative-url'] = $xml_response->video->creative;
                             $ad['video-duration'] = $xml_response->video->duration;
                             $ad['video-skipbutton-show'] = $xml_response->video->skipbutton['show'];
                             $ad['video-skipbutton-showafter'] = $xml_response->video->skipbutton['showafter'];
                             $ad['video-navigation-show'] = $xml_response->video->navigation['show'];
                             $ad['video-navigation-allowtap'] = $xml_response->video->navigation['allowtap'];
                             $ad['video-navigation-topbar-show'] = $xml_response->video->navigation->topbar['show'];
                             $ad['video-navigation-bottombar-show'] = $xml_response->video->navigation->bottombar['show'];
                             $ad['video-navigation-topbar-custombg'] = $xml_response->video->navigation->topbar['custombackgroundurl'];
                             $ad['video-navigation-bottombar-custombg'] = $xml_response->video->navigation->bottombar['custombackgroundurl'];
                             $ad['video-navigation-bottombar-pausebutton'] = $xml_response->video->navigation->bottombar['pausebutton'];
                             $ad['video-navigation-bottombar-replaybutton'] = $xml_response->video->navigation->bottombar['replaybutton'];
                             $ad['video-navigation-bottombar-timer'] = $xml_response->video->navigation->bottombar['timer'];
                             $ad['video-trackers'] = array();
                             foreach ($xml_response->video->trackingevents->tracker as $video_tracker) {
                                 $tracker_type = $video_tracker['type'];
                                 $tracker_url = $video_tracker;
                                 $xadd = array($tracker_type, $tracker_url);
                                 array_push($ad['video-trackers'], $xadd);
                             }
                             $ad['video-htmloverlay-show'] = $xml_response->video->htmloverlay['show'];
                             $ad['video-htmloverlay-showafter'] = $xml_response->video->htmloverlay['showafter'];
                             $ad['video-htmloverlay-type'] = $xml_response->video->htmloverlay['type'];
                             if ($ad['video-htmloverlay-type'] == 'url') {
                                 $ad['video-htmloverlay-content'] = $xml_response->video->htmloverlay['url'];
                             }
                             if ($ad['video-htmloverlay-type'] == 'markup') {
                                 $ad['video-htmloverlay-content'] = $xml_response->video->htmloverlay;
                             }
                             /* Video */
                             return $ad;
                         } else {
                             return false;
                         }
                     }
                 }
             }
         }
     }
 }
示例#15
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'GET';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://ads.admarvel.com/fam/postGetAd.php';
         $http->addParam('partner_id', $network_ids['p_1']);
         $http->addParam('site_id', $network_ids['p_2']);
         $http->addParam('version', '1.5');
         $http->addParam('language', 'php');
         $http->addParam('format', 'wap');
         $http->addParam('target_params', 'RESPONSE_TYPE=>xml');
         $http->addParam('phone_headers', 'REMOTE_ADDR=>' . $request_info['ip_address'] . '||HTTP_USER_AGENT=>' . $request_info['user_agent'] . '');
         if (isset($_GET['o'])) {
             $http->addParam('UNIQUE_ID', $_GET['o']);
         }
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     try {
         $xml_response = new SimpleXmlElement($http->result, LIBXML_NOCDATA);
     } catch (Exception $e) {
         // handle the error
         return false;
     }
     if (isset($xml_response->image->url)) {
         $tempad['image'] = $xml_response->image->url;
     } else {
         $tempad['image'] = '';
     }
     if (isset($xml_response->clickurl)) {
         $tempad['url'] = $xml_response->clickurl;
     } else {
         $tempad['url'] = '';
     }
     if (isset($xml_response->text)) {
         $tempad['text'] = $xml_response->text;
     } else {
         $tempad['text'] = '';
     }
     if (isset($xml_response['type'])) {
         $tempad['type'] = $xml_response['type'];
     } else {
         $tempad['type'] = '';
     }
     if (isset($xml_response->pixels->pixel)) {
         $tempad['pixel'] = $xml_response->pixels->pixel;
     } else {
         $tempad['pixel'] = '';
     }
     if ($request_type == 'banner') {
         if ($xml_response['type'] == 'image') {
             $ad = array();
             $ad['main_type'] = 'display';
             $ad['type'] = 'image-url';
             $ad['click_url'] = $tempad['url'];
             $ad['trackingpixel'] = $tempad['pixel'];
             $ad['image_url'] = $tempad['image'];
             $ad['clicktype'] = 'safari';
             $ad['skipoverlay'] = 0;
             $ad['skippreflight'] = 'yes';
             return $ad;
         } else {
             if ($xml_response['type'] == 'text') {
                 $ad = array();
                 $ad['main_type'] = 'display';
                 $ad['type'] = 'markup';
                 $ad['click_url'] = $tempad['url'];
                 $ad['html_markup'] = '<a href="' . $tempad['url'] . '">' . $tempad['text'] . '</a>';
                 $ad['trackingpixel'] = $tempad['pixel'];
                 $ad['image_url'] = '';
                 $ad['clicktype'] = 'safari';
                 $ad['skipoverlay'] = 0;
                 $ad['skippreflight'] = 'yes';
                 return $ad;
             } else {
                 return false;
             }
         }
     } else {
         return false;
     }
     /*F:END*/
 }
示例#16
0
<?php

// Include the Http Class
include_once 'class.http.php';
// Instantiate it
$http = new Http();
// Let's not use cURL
$http->useCurl(false);
// POST method
$http->setMethod('POST');
// POST parameters
$http->addParam('user_name', 'yourusername');
$http->addParam('password', 'yourpassword');
// Referrer
$http->setReferrer('https://yourproject.projectpath.com/login');
// Get basecamp dashboard (HTTPS)
$http->execute('https://yourproject.projectpath.com/login/authenticate');
// Show result page or error if occurred
echo $http->error ? $http->error : $http->result;
示例#17
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'POST';
     $httpConfig['timeout'] = '1';
     $httpConfig['special'] = 'MADVERTISE';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://ad.madvertise.de/site/' . $network_ids['p_1'] . '';
         $http->addParam('ua', $request_info['user_agent']);
         $http->addParam('ip', $request_info['ip_address']);
         $http->addParam('url', $request_info['referer']);
         $http->addParam('requester', 'madserve_api');
         $http->addParam('version', 'api_2.1');
         $http->addParam('lng', $request_info['longitude']);
         $http->addParam('lat', $request_info['latitude']);
         $http->addParam('site_url', $request_info['referer']);
         $http->addParam('must_have_banner', true);
         /*Zone Size Identification*/
         if ($zone_detail['zone_width'] == '766' && $zone_detail['zone_height'] == '66') {
             $http->addParam('banner_type', 'portrait');
         } else {
             if ($zone_detail['zone_width'] == '300' && $zone_detail['zone_height'] == '250') {
                 $http->addParam('banner_type', 'medium_rectangle,mma');
             } else {
                 if ($zone_detail['zone_width'] == '1024' && $zone_detail['zone_height'] == '66') {
                     $http->addParam('banner_type', 'landscape');
                 } else {
                     if ($zone_detail['zone_width'] == '768' && $zone_detail['zone_height'] == '768') {
                         $http->addParam('banner_type', 'fullscreen');
                     } else {
                         if ($zone_detail['zone_width'] == '728' && $zone_detail['zone_height'] == '90') {
                             $http->addParam('banner_type', 'leaderboard');
                         } else {
                             $http->addParam('banner_type', 'mma');
                         }
                     }
                 }
             }
         }
         /*END: Zone Size Identification*/
         if (isset($_GET['o'])) {
             $http->addParam('unique_device_id', $_GET['o']);
         } else {
             if (isset($_GET['o_mcsha1'])) {
                 $http->addParam('unique_device_id', $_GET['o_mcsha1']);
             } else {
                 if (isset($_GET['o_mcmd5'])) {
                     $http->addParam('unique_device_id', $_GET['o_mcmd5']);
                 } else {
                     if (isset($_GET['o_openudid'])) {
                         $http->addParam('unique_device_id', $_GET['o_openudid']);
                     }
                 }
             }
         }
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     try {
         $xml_response = new SimpleXmlElement($http->result, LIBXML_NOCDATA);
     } catch (Exception $e) {
         // handle the error
         return false;
     }
     if (isset($xml_response->click_url) && isset($xml_response->banner_url) && !empty($xml_response->banner_url)) {
         $ad = array();
         $ad['main_type'] = 'display';
         $ad['type'] = 'image-url';
         $ad['click_url'] = $xml_response->click_url;
         if (isset($xml_response->tracking->url) && !empty($xml_response->tracking->url)) {
             $ad['trackingpixel'] = $xml_response->tracking->url;
         } else {
             $ad['trackingpixel'] = '';
         }
         $ad['image_url'] = $xml_response->banner_url;
         $ad['clicktype'] = 'safari';
         $ad['skipoverlay'] = 0;
         $ad['skippreflight'] = 'yes';
         return $ad;
     } else {
         return false;
     }
     /*F:END*/
 }
示例#18
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     $httpConfig['method'] = 'GET';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://api.mobpartner.mobi';
         $http->addParam('pool', $network_ids['p_1']);
         $http->addParam('ua', $request_info['user_agent']);
         $http->addParam('ip', $request_info['ip_address']);
         if (isset($_GET['o'])) {
             $http->addParam('udid', $_GET['o']);
         } else {
             if (isset($_GET['o_mcsha1'])) {
                 $http->addParam('udid', $_GET['o_mcsha1']);
             }
         }
         $http->addParam('api', 'param');
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     $response = $http->result;
     if ($response != '') {
         $banner = explode('><', $response);
         @($type = $banner[0]);
         @($link_url = $banner[1]);
         @($image_url = $banner[2]);
         @($text = $banner[3]);
         if ($type && $link_url) {
             if ($type == 1 or $type == 2) {
                 $ad = array();
                 $ad['main_type'] = 'display';
                 $ad['type'] = 'image-url';
                 $ad['click_url'] = $link_url;
                 $ad['trackingpixel'] = '';
                 $ad['image_url'] = $image_url;
                 $ad['clicktype'] = 'safari';
                 $ad['skipoverlay'] = 0;
                 $ad['skippreflight'] = 'yes';
                 return $ad;
             } else {
                 if ($type == 3) {
                     $ad = array();
                     $ad['main_type'] = 'display';
                     $ad['type'] = 'markup';
                     $ad['click_url'] = $link_url;
                     $ad['html_markup'] = '<a href="' . $link_url . '">' . $text . '</a>';
                     $ad['trackingpixel'] = '';
                     $ad['image_url'] = '';
                     $ad['clicktype'] = 'safari';
                     $ad['skipoverlay'] = 0;
                     $ad['skippreflight'] = 'yes';
                     return $ad;
                 } else {
                     return false;
                 }
             }
         } else {
             return false;
         }
     } else {
         return false;
     }
     /*F:END*/
 }
示例#19
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'GET';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://ads.mdotm.com/ads/feed.php';
         $http->addParam('partnerkey', $network_ids['p_1']);
         $http->addParam('apikey', $network_ids['p_2']);
         $http->addParam('secretkey', $network_ids['p_3']);
         $http->addParam('appkey', $network_ids['p_4']);
         if (isset($_GET['o'])) {
             $http->addParam('deviceid', $_GET['o']);
         } else {
             if (isset($_GET['o_mcsha1'])) {
                 $http->addParam('deviceid', $_GET['o_mcsha1']);
             } else {
                 if (isset($_GET['o_mcmd5'])) {
                     $http->addParam('deviceid', $_GET['o_mcmd5']);
                 } else {
                     if (isset($_GET['o_openudid'])) {
                         $http->addParam('deviceid', $_GET['o_openudid']);
                     }
                 }
             }
         }
         $http->addParam('ua', $request_info['user_agent']);
         $http->addParam('clientip', $request_info['ip_address']);
         $http->addParam('height', $zone_detail['zone_height']);
         $http->addParam('width', $zone_detail['zone_width']);
         $http->addParam('fmt', 'json');
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     try {
         $json_response = json_decode($http->result);
     } catch (Exception $e) {
         // handle the error
         return false;
     }
     if (isset($json_response[0]->img_url)) {
         $tempad['image'] = $json_response[0]->img_url;
     } else {
         $tempad['image'] = '';
     }
     if (isset($json_response[0]->landing_url)) {
         $tempad['url'] = $json_response[0]->landing_url;
     } else {
         $tempad['url'] = '';
     }
     if ($tempad['image'] != '' && $tempad['url']) {
         $ad = array();
         $ad['main_type'] = 'display';
         $ad['type'] = 'image-url';
         $ad['click_url'] = $tempad['url'];
         $ad['trackingpixel'] = '';
         $ad['image_url'] = $tempad['image'];
         $ad['clicktype'] = 'safari';
         $ad['skipoverlay'] = 0;
         $ad['skippreflight'] = 'yes';
         return $ad;
     } else {
         return false;
     }
     /*F:END*/
 }
示例#20
0
<?php

// Include the Http Class
include_once 'class.http.php';
// Instantiate it
$http = new Http();
// Set API parameters
$http->addParam('appid', 'a_really_random_yahoo_app_id');
$http->addParam('context', 'I am happy because I bought a new car');
$http->addParam('output', 'xml');
// Get the extracted term
$http->execute('http://search.yahooapis.com/ContentAnalysisService/V1/termExtraction');
// Show result xml or error if occurred
echo $http->error ? $http->error : $http->result;
示例#21
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'GET';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://ads.mp.mydas.mobi/getAd.php5';
         $http->addParam('apid', $network_ids['p_1']);
         $http->addParam('uip', $request_info['ip_address']);
         $http->addParam('ua', $request_info['user_agent']);
         if (isset($_GET['o'])) {
             $http->addParam('auid', $_GET['o']);
         } else {
             if (isset($_GET['o_mcsha1'])) {
                 $http->addParam('auid', $_GET['o_mcsha1']);
             } else {
                 $http->addParam('auid', $request_info['ip_address']);
             }
         }
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     if (preg_match("/href='([^']*)'/i", $http->result, $regs)) {
         $tempad['url'] = $regs[1];
     } else {
         if (preg_match('/href="([^"]*)"/i', $http->result, $regsx)) {
             $tempad['url'] = $regsx[1];
         } else {
             if (preg_match("<script>", $http->result)) {
                 $tempad['url'] = '';
             } else {
                 if (preg_match("<noscript>", $http->result)) {
                     $tempad['url'] = '';
                 } else {
                     return false;
                 }
             }
         }
     }
     $ad = array();
     $ad['main_type'] = 'display';
     $ad['type'] = 'markup';
     $tempad['url'] = str_replace("&amp;", "&", $tempad['url']);
     $ad['click_url'] = $tempad['url'];
     $tempad['markup'] = str_replace("&amp;", "&", $http->result);
     $ad['html_markup'] = $tempad['markup'];
     $ad['trackingpixel'] = '';
     $ad['image_url'] = '';
     $ad['clicktype'] = 'safari';
     $ad['skipoverlay'] = 0;
     $ad['skippreflight'] = 'yes';
     return $ad;
     /*F:END*/
 }
示例#22
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'GET';
     $httpConfig['timeout'] = '1';
     $httpConfig['referrer'] = $request_info['referer'];
     $httpConfig['user_agent'] = $request_info['user_agent'];
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://adserver.ubiyoo.com/adbanner.php';
         $http->addParam('who', $network_ids['p_1']);
         $http->addParam('format', 'adsnipplet');
         $http->addParam('gateway', $request_info['ip_address']);
         $http->addParam('width', $zone_detail['zone_width']);
         if (isset($_GET['o'])) {
             $http->addParam('cid', md5($_GET['o']));
         } else {
             if (isset($_GET['o_mcsha1'])) {
                 $http->addParam('cid', md5($_GET['o_mcsha1']));
             } else {
                 if (isset($_GET['o_mcmd5'])) {
                     $http->addParam('cid', md5($_GET['o_mcmd5']));
                 } else {
                     if (isset($_GET['o_openudid'])) {
                         $http->addParam('cid', md5($_GET['o_openudid']));
                     }
                 }
             }
         }
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     if (substr($http->result, 0, 2) == '<p') {
         // GET AD LINK
         if (preg_match('/href="([^"]*)"/i', $http->result, $regs)) {
             $ad['url'] = $regs[1];
         }
         // GET AD IMAGE URL
         if (preg_match('/src="([^"]*)"/i', $http->result, $regsa)) {
             $ad['image'] = $regsa[1];
         }
         if ($ad['url'] != "" && $ad['image'] != "") {
             $ad = array();
             $ad['main_type'] = 'display';
             $ad['type'] = 'image-url';
             $ad['click_url'] = $ad['url'];
             $ad['trackingpixel'] = '';
             $ad['image_url'] = $ad['image'];
             $ad['clicktype'] = 'safari';
             $ad['skipoverlay'] = 0;
             $ad['skippreflight'] = 'yes';
             return $ad;
         } else {
             return false;
         }
     } else {
         return false;
     }
     /*F:END*/
 }
示例#23
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'GET';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner' or $request_type == 'interstitial') {
         $request_url = 'http://sjc.ads.nexage.com/adServe';
         $http->addParam('dcn', $network_ids['p_1']);
         $http->addParam('pos', $network_ids['p_2']);
         $http->addParam('ua', $request_info['user_agent']);
         $http->addParam('ip', $request_info['ip_address']);
         if (isset($_GET['o'])) {
             $http->addParam('d(id2)', sha1($_GET['o']));
         }
         if (isset($_GET['o_mcsha1'])) {
             $http->addParam('d(id3)', $_GET['o_mcsha1']);
         }
         if (isset($_GET['o_mcmd5'])) {
             $http->addParam('d(id13)', $_GET['o_mcmd5']);
         }
         $http->addParam('req(url)', urlencode($request_info['referer']));
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     if (preg_match("/href='([^']*)'/i", $http->result, $regs)) {
         $tempad['url'] = $regs[1];
     } else {
         if (preg_match('/href="([^"]*)"/i', $http->result, $regsx)) {
             $tempad['url'] = $regsx[1];
         } else {
             return false;
         }
     }
     if ($request_type == 'banner') {
         $ad = array();
         $ad['main_type'] = 'display';
         $ad['type'] = 'markup';
         $ad['click_url'] = $tempad['url'];
         $ad['html_markup'] = $http->result;
         $ad['trackingpixel'] = '';
         $ad['image_url'] = '';
         $ad['clicktype'] = 'safari';
         $ad['skipoverlay'] = 0;
         $ad['skippreflight'] = 'yes';
         $ad['click_url'] = str_replace('&amp;', '&', $ad['click_url']);
         $ad['html_markup'] = str_replace('&amp;', '&', $ad['html_markup']);
         return $ad;
     } else {
         if ($request_type == 'interstitial') {
             $ad = array();
             $ad['main_type'] = 'interstitial';
             $ad['type'] = 'interstitial';
             $ad['animation'] = 'None';
             /* Interstitial */
             $ad['interstitial-orientation'] = 'portrait';
             $ad['interstitial-preload'] = 0;
             $ad['interstitial-autoclose'] = 0;
             $ad['interstitial-type'] = 'markup';
             $ad['interstitial-content'] = $http->result;
             $ad['interstitial-skipbutton-show'] = 1;
             $ad['interstitial-skipbutton-showafter'] = 0;
             $ad['interstitial-navigation-show'] = 0;
             $ad['interstitial-navigation-topbar-show'] = 0;
             $ad['interstitial-navigation-bottombar-show'] = 0;
             $ad['interstitial-navigation-topbar-custombg'] = '';
             $ad['interstitial-navigation-bottombar-custombg'] = '';
             $ad['interstitial-navigation-topbar-titletype'] = 'fixed';
             $ad['interstitial-navigation-topbar-titlecontent'] = '';
             $ad['interstitial-navigation-bottombar-backbutton'] = 0;
             $ad['interstitial-navigation-bottombar-forwardbutton'] = 0;
             $ad['interstitial-navigation-bottombar-reloadbutton'] = 0;
             $ad['interstitial-navigation-bottombar-externalbutton'] = 0;
             $ad['interstitial-navigation-bottombar-timer'] = 0;
             $ad['interstitial-content'] = str_replace('&amp;', '&', $ad['interstitial-content']);
             /* Interstitial */
             return $ad;
         }
     }
     /*F:END*/
 }
示例#24
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'GET';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://generic.aditic.net/';
         $http->addParam('alid', $network_ids['p_1']);
         $http->addParam('pid', $network_ids['p_2']);
         $http->addParam('ua', $request_info['user_agent']);
         $http->addParam('srcip', $request_info['ip_address']);
         $http->addParam('network', 'wifi');
         $http->addParam('format', 'xml');
         if ($request_info['main_device'] == 'IPHONE' or $request_info['main_device'] == 'IPOD TOUCH') {
             $http->addParam('support', 'iphone');
         } else {
             if ($request_info['main_device'] == 'IPAD') {
                 $http->addParam('support', 'ipad');
             } else {
                 if ($request_info['main_device'] == 'ANDROID') {
                     $http->addParam('support', 'android');
                 } else {
                     $http->addParam('support', 'wap');
                 }
             }
         }
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     try {
         $xml_response = new SimpleXmlElement($http->result, LIBXML_NOCDATA);
     } catch (Exception $e) {
         // handle the error
         return false;
     }
     $ad['type'] = $xml_response->type;
     $ad['image'] = $xml_response->image1;
     $ad['url'] = $xml_response->clic;
     $error['code'] = $xml_response->code;
     if (isset($xml_response->code)) {
         $tempad['code'] = $xml_response->code;
     } else {
         $tempad['code'] = '';
     }
     if (isset($xml_response->clic)) {
         $tempad['url'] = $xml_response->clic;
     } else {
         $tempad['url'] = '';
     }
     if (isset($xml_response->image1)) {
         $tempad['image'] = $xml_response->image1;
     } else {
         $tempad['image'] = '';
     }
     if (isset($xml_response->texte1)) {
         $tempad['text'] = $xml_response->texte1;
     } else {
         $tempad['text'] = '';
     }
     if (isset($xml_response->type)) {
         $tempad['type'] = $xml_response->type;
     } else {
         $tempad['type'] = '';
     }
     if ($tempad['url'] != '') {
         if ($tempad['type'] == 'banner' or $tempad['type'] == 'bannertext') {
             $ad = array();
             $ad['main_type'] = 'display';
             $ad['type'] = 'image-url';
             $ad['click_url'] = $tempad['url'];
             $ad['trackingpixel'] = '';
             $ad['image_url'] = $tempad['image'];
             $ad['clicktype'] = 'safari';
             $ad['skipoverlay'] = 0;
             $ad['skippreflight'] = 'yes';
             return $ad;
         } else {
             if ($tempad['type'] == 'textlink') {
                 $ad = array();
                 $ad['main_type'] = 'display';
                 $ad['type'] = 'markup';
                 $ad['click_url'] = $tempad['url'];
                 $ad['html_markup'] = '<a href="' . $tempad['url'] . '">' . $tempad['text'] . '</a>';
                 $ad['trackingpixel'] = '';
                 $ad['image_url'] = '';
                 $ad['clicktype'] = 'safari';
                 $ad['skipoverlay'] = 0;
                 $ad['skippreflight'] = 'yes';
                 return $ad;
             } else {
                 return false;
             }
         }
     } else {
         return false;
     }
     //old below
     if (isset($xml_response->error) && !empty($xml_response->error)) {
         return false;
     } else {
         if (isset($xml_response->ad['type']) && ($xml_response->ad['type'] == 'image' or $xml_response->ad['type'] == 'image/jpeg' or $xml_response->ad['type'] == 'text' or $xml_response->ad['type'] == 'thirdparty' or $xml_response->ad['type'] == 'richmedia')) {
             $ad = array();
             switch ($xml_response->ad['type']) {
                 case 'image':
                 case 'image/jpeg':
                     $ad['main_type'] = 'display';
                     $ad['type'] = 'image-url';
                     $ad['click_url'] = $xml_response->ad->url;
                     $ad['trackingpixel'] = $xml_response->ad->track;
                     $ad['image_url'] = $xml_response->ad->img;
                     $ad['clicktype'] = 'safari';
                     $ad['skipoverlay'] = 0;
                     $ad['skippreflight'] = 'yes';
                     break;
                 case 'text':
                     $ad['main_type'] = 'display';
                     $ad['type'] = 'markup';
                     $ad['click_url'] = $xml_response->ad->url;
                     $ad['html_markup'] = '<a href="' . $xml_response->ad->url . '">' . $xml_response->ad->text . '</a>';
                     $ad['trackingpixel'] = $xml_response->ad->track;
                     $ad['image_url'] = '';
                     $ad['clicktype'] = 'safari';
                     $ad['skipoverlay'] = 0;
                     $ad['skippreflight'] = 'yes';
                     break;
                 case 'thirdparty':
                     $ad['main_type'] = 'display';
                     $ad['type'] = 'markup';
                     $ad['click_url'] = $xml_response->ad->url;
                     $ad['html_markup'] = $xml_response->ad->content;
                     $ad['trackingpixel'] = $xml_response->ad->track;
                     $ad['image_url'] = '';
                     $ad['clicktype'] = 'safari';
                     $ad['skipoverlay'] = 0;
                     $ad['skippreflight'] = 'yes';
                     break;
                 case 'richmedia':
                     $ad['main_type'] = 'display';
                     $ad['type'] = 'mraid-markup';
                     $ad['click_url'] = $xml_response->ad->url;
                     $ad['html_markup'] = $xml_response->ad->content;
                     $ad['trackingpixel'] = $xml_response->ad->track;
                     $ad['image_url'] = '';
                     $ad['clicktype'] = 'safari';
                     $ad['skipoverlay'] = 1;
                     $ad['skippreflight'] = 'yes';
                     break;
             }
             return $ad;
         } else {
             return false;
         }
     }
     /*F:END*/
 }
示例#25
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'GET';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner' or $request_type == 'interstitial') {
         $request_url = 'http://serve.vdopia.com/adserver/html5/adFetch/';
         $http->addParam('ak', $network_ids['p_1']);
         if ($request_type == 'banner') {
             $http->addParam('adFormat', 'vdobanner');
         } else {
             if ($request_type == 'interstitial') {
                 $http->addParam('adFormat', 'preappvideo');
             }
         }
         $http->addParam('output', 'xhtml');
         $http->addParam('showClose', '0');
         $http->addParam('sleepAfter', '0');
         $http->addParam('version', '1.0');
         $http->addParam('ua', $request_info['user_agent']);
         $http->addParam('ipAddress', $request_info['ip_address']);
         if (isset($_GET['o'])) {
             $http->addParam('di', sha1($_GET['o']));
             $http->addParam('dif', 'ds');
         } else {
             if (isset($_GET['o_mcsha1'])) {
                 $http->addParam('di', $_GET['o_mcsha1']);
                 $http->addParam('ms', 'ds');
             } else {
                 if (isset($_GET['o_mcmd5'])) {
                     $http->addParam('di', $_GET['o_mcmd5']);
                     $http->addParam('mm', 'ds');
                 }
             }
         }
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     if ($http->result == '') {
         return false;
     }
     try {
         $xml_response = new SimpleXmlElement($http->result, LIBXML_NOCDATA);
     } catch (Exception $e) {
         // handle the error
         return false;
     }
     if (isset($xml_response->xhtml)) {
         $tempad['markup'] = $xml_response->xhtml;
     } else {
         $tempad['markup'] = '';
     }
     if (isset($xml_response['type'])) {
         $tempad['type'] = $xml_response['type'];
     } else {
         $tempad['type'] = '';
     }
     if ($tempad['type'] == 'error') {
         return false;
     }
     if ($tempad['markup'] != '') {
         if ($request_type == 'banner') {
             $ad = array();
             $ad['main_type'] = 'display';
             $ad['type'] = 'markup';
             $ad['click_url'] = '';
             $ad['html_markup'] = $tempad['markup'];
             $ad['trackingpixel'] = '';
             $ad['image_url'] = '';
             $ad['clicktype'] = 'safari';
             $ad['skipoverlay'] = 0;
             $ad['skippreflight'] = 'yes';
             return $ad;
         } else {
             if ($request_type == 'interstitial') {
                 $ad = array();
                 $ad['main_type'] = 'interstitial';
                 $ad['type'] = 'interstitial';
                 $ad['animation'] = 'None';
                 /* Interstitial */
                 $ad['interstitial-orientation'] = 'portrait';
                 $ad['interstitial-preload'] = 0;
                 $ad['interstitial-autoclose'] = 0;
                 $ad['interstitial-type'] = 'markup';
                 $ad['interstitial-content'] = $tempad['markup'];
                 $ad['interstitial-skipbutton-show'] = 1;
                 $ad['interstitial-skipbutton-showafter'] = 0;
                 $ad['interstitial-navigation-show'] = 0;
                 $ad['interstitial-navigation-topbar-show'] = 0;
                 $ad['interstitial-navigation-bottombar-show'] = 0;
                 $ad['interstitial-navigation-topbar-custombg'] = '';
                 $ad['interstitial-navigation-bottombar-custombg'] = '';
                 $ad['interstitial-navigation-topbar-titletype'] = 'fixed';
                 $ad['interstitial-navigation-topbar-titlecontent'] = '';
                 $ad['interstitial-navigation-bottombar-backbutton'] = 0;
                 $ad['interstitial-navigation-bottombar-forwardbutton'] = 0;
                 $ad['interstitial-navigation-bottombar-reloadbutton'] = 0;
                 $ad['interstitial-navigation-bottombar-externalbutton'] = 0;
                 $ad['interstitial-navigation-bottombar-timer'] = 0;
                 /* Interstitial */
                 return $ad;
             }
         }
     } else {
         return false;
     }
     //old below
     // GET AD LINK
     if (preg_match('/href="([^"]*)"/i', $http->result, $regs)) {
         $tempad['url'] = $regs[1];
     } else {
         $tempad['url'] = '';
     }
     // GET AD IMAGE URL
     if (preg_match('/src="([^"]*)"/i', $http->result, $regsa)) {
         $tempad['image'] = $regsa[1];
     } else {
         $tempad['image'] = '';
     }
     if ($ad['url'] != "" && $ad['image'] != "") {
         $ad = array();
         $ad['main_type'] = 'display';
         $ad['type'] = 'markup';
         $ad['click_url'] = $tempad['url'];
         $ad['html_markup'] = $http->result;
         $ad['trackingpixel'] = '';
         $ad['image_url'] = '';
         $ad['clicktype'] = 'safari';
         $ad['skipoverlay'] = 0;
         $ad['skippreflight'] = 'yes';
         return $ad;
     } else {
         return false;
     }
     /*F:END*/
 }
示例#26
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'GET';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://ads.mocean.mobi/ad';
         $http->addParam('site', $network_ids['p_1']);
         $http->addParam('zone', $network_ids['p_2']);
         $http->addParam('ua', $request_info['user_agent']);
         $http->addParam('ip', $request_info['ip_address']);
         $http->addParam('url', $request_info['referer']);
         if (isset($_GET['o'])) {
             $http->addParam('udid', md5($_GET['o']));
         } else {
             if (isset($_GET['o_mcsha1'])) {
                 $http->addParam('udid', md5($_GET['o_mcsha1']));
             } else {
                 if (isset($_GET['o_mcmd5'])) {
                     $http->addParam('udid', md5($_GET['o_mcmd5']));
                 } else {
                     if (isset($_GET['o_openudid'])) {
                         $http->addParam('udid', md5($_GET['o_openudid']));
                     }
                 }
             }
         }
         $http->addParam('key', '3');
         $http->addParam('type', '-1');
         $http->addParam('size_y', $zone_detail['zone_height']);
         $http->addParam('size_x', $zone_detail['zone_width']);
         $http->addParam('long', $request_info['longitude']);
         $http->addParam('lat', $request_info['latitude']);
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     try {
         $xml_response = new SimpleXmlElement($http->result, LIBXML_NOCDATA);
     } catch (Exception $e) {
         // handle the error
         return false;
     }
     if (isset($xml_response->error) && !empty($xml_response->error)) {
         return false;
     } else {
         if (isset($xml_response->ad['type']) && ($xml_response->ad['type'] == 'image' or $xml_response->ad['type'] == 'image/jpeg' or $xml_response->ad['type'] == 'text' or $xml_response->ad['type'] == 'thirdparty' or $xml_response->ad['type'] == 'richmedia')) {
             $ad = array();
             switch ($xml_response->ad['type']) {
                 case 'image':
                 case 'image/jpeg':
                     $ad['main_type'] = 'display';
                     $ad['type'] = 'image-url';
                     $ad['click_url'] = $xml_response->ad->url;
                     $ad['trackingpixel'] = $xml_response->ad->track;
                     $ad['image_url'] = $xml_response->ad->img;
                     $ad['clicktype'] = 'safari';
                     $ad['skipoverlay'] = 0;
                     $ad['skippreflight'] = 'yes';
                     break;
                 case 'text':
                     $ad['main_type'] = 'display';
                     $ad['type'] = 'markup';
                     $ad['click_url'] = $xml_response->ad->url;
                     $ad['html_markup'] = '<a href="' . $xml_response->ad->url . '">' . $xml_response->ad->text . '</a>';
                     $ad['trackingpixel'] = $xml_response->ad->track;
                     $ad['image_url'] = '';
                     $ad['clicktype'] = 'safari';
                     $ad['skipoverlay'] = 0;
                     $ad['skippreflight'] = 'yes';
                     break;
                 case 'thirdparty':
                     $ad['main_type'] = 'display';
                     $ad['type'] = 'markup';
                     $ad['click_url'] = $xml_response->ad->url;
                     $ad['html_markup'] = $xml_response->ad->content;
                     $ad['trackingpixel'] = $xml_response->ad->track;
                     $ad['image_url'] = '';
                     $ad['clicktype'] = 'safari';
                     $ad['skipoverlay'] = 0;
                     $ad['skippreflight'] = 'yes';
                     break;
                 case 'richmedia':
                     $ad['main_type'] = 'display';
                     $ad['type'] = 'mraid-markup';
                     $ad['click_url'] = $xml_response->ad->url;
                     $ad['html_markup'] = $xml_response->ad->content;
                     $ad['trackingpixel'] = $xml_response->ad->track;
                     $ad['image_url'] = '';
                     $ad['clicktype'] = 'safari';
                     $ad['skipoverlay'] = 1;
                     $ad['skippreflight'] = 'yes';
                     break;
             }
             return $ad;
         } else {
             return false;
         }
     }
     /*F:END*/
 }
示例#27
0
 public function request($request_type, $request_info, $network_ids, $backfill)
 {
     /*F:START*/
     error_reporting(0);
     /*Catch XML Exceptions*/
     global $zone_detail;
     $httpConfig['method'] = 'POST';
     $httpConfig['timeout'] = '1';
     $http = new Http();
     $http->initialize($httpConfig);
     if ($request_type == 'banner') {
         $request_url = 'http://api.4info.com/AdHaven/v1/getAd';
         $http->addParam('api_key', $network_ids['p_1']);
         $http->addParam('placement_id', $network_ids['p_2']);
         $http->addParam('date', gmdate(DATE_RFC1123));
         $http->addParam('header_user-agent', $request_info['user_agent']);
         $http->addParam('header_REMOTE_ADDR', $request_info['ip_address']);
         $http->addParam('client_ip', $request_info['ip_address']);
         if (isset($_GET['o'])) {
             $http->addParam('device_id', $_GET['o']);
         }
         $http->addParam('lat_lon', $request_info['latitude'] . ',' . $request_info['longitude']);
     } else {
         return false;
     }
     $http->execute($request_url);
     if ($http->error) {
         return false;
     }
     if ($http->result == '') {
         return false;
     }
     try {
         $xml_response = new SimpleXmlElement($http->result, LIBXML_NOCDATA);
     } catch (Exception $e) {
         // handle the error
         return false;
     }
     if (isset($xml_response->ad->markup)) {
         $tempad['markup'] = $xml_response->ad->markup;
     } else {
         return false;
     }
     if ($tempad['markup'] == '') {
         return false;
     }
     if (preg_match("/href='([^']*)'/i", $tempad['markup'], $regs)) {
         $tempad['url'] = $regs[1];
     } else {
         if (preg_match('/href="([^"]*)"/i', $tempad['markup'], $regsx)) {
             $tempad['url'] = $regsx[1];
         }
     }
     if (preg_match("/src='([^']*)'/i", $tempad['markup'], $regsa)) {
         $tempad['image'] = $regsa[1];
     } else {
         if (preg_match('/src="([^"]*)"/i', $tempad['markup'], $regsax)) {
             $tempad['image'] = $regsax[1];
         }
     }
     if (isset($tempad['image']) && isset($tempad['url'])) {
         $tempad['url'] = str_replace("&amp;", "&", $tempad['url']);
         $ad = array();
         $ad['main_type'] = 'display';
         $ad['type'] = 'image-url';
         $ad['click_url'] = $tempad['url'];
         $ad['trackingpixel'] = '';
         $ad['image_url'] = $tempad['image'];
         $ad['clicktype'] = 'safari';
         $ad['skipoverlay'] = 0;
         $ad['skippreflight'] = 'yes';
         return $ad;
     } else {
         return false;
     }
     /*F:END*/
 }