当前位置: 首页>>代码示例>>PHP>>正文


PHP Http::initialize方法代码示例

本文整理汇总了PHP中Http::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::initialize方法的具体用法?PHP Http::initialize怎么用?PHP Http::initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Http的用法示例。


在下文中一共展示了Http::initialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: request

 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*/
 }
开发者ID:aiurlano,项目名称:mAdserve-Fork,代码行数:56,代码来源:request.php

示例2: request

 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*/
 }
开发者ID:liulingfu,项目名称:madserve,代码行数:48,代码来源:request.php


注:本文中的Http::initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。