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


PHP Http::getContent方法代码示例

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


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

示例1: daemonFunc

 /**
  * 完善daemon处理函数,此函数必备
  *
  *
  */
 function daemonFunc()
 {
     require dirname(__FILE__) . '/../../config/testUI/config.php';
     $redis = new Predis\Client($_config['redis_server']);
     $http = new Http();
     while ($this->subProcessCheck()) {
         //处理队列
         $case_data = $redis->lpop($_config['queue_name']);
         if (empty($case_data)) {
             break;
         } else {
             $arr = json_decode($case_data, true);
             $url = $arr['host'] . $arr['url'];
             $query = $arr['param'];
             $method = strtoupper($arr['method']);
             //拼装表单提交数据
             $formdata = array();
             $temp_arry = explode('&', $query);
             foreach ($temp_arry as $item) {
                 list($k, $v) = explode('=', $item);
                 $formdata[$k] = $v;
             }
             //判断是否需要token
             if (isset($arr['token'])) {
                 $formdata['token'] = $arr['token'];
             }
             if ($method == 'GET') {
                 $http->get($url, $formdata);
             } else {
                 $http->post($url, $formdata);
             }
             $res = $http->getContent();
             //此处增加返回结果的判断
             $result = $arr['result'];
             if ($result == $res) {
                 $res_test = 1;
             } else {
                 $res_test = 0;
             }
             //                $req['url'] = $url;
             //                $req['data'] = $formdata;
             //$result =array();
             file_put_contents(realpath(dirname(__FILE__)) . '/../../output/testUI.log', $res_test . '|' . $result . '|' . $res . '|' . $url . '|' . json_encode($formdata) . "\n", FILE_APPEND);
         }
         //增加处理数,不增加处理数,就需要子进程本身有退出机制。
         //$this->requestCount++;
         //释放时间片
         usleep(5000);
     }
 }
开发者ID:mendianchun,项目名称:at,代码行数:55,代码来源:index.php

示例2: act_accountInforIntegation

 public function act_accountInforIntegation()
 {
     $dpId = $_REQUEST['dpId'];
     $developerMod = M('Developer');
     if (!$dpId) {
         self::$errMsg['12000'] = "未获取到该用户的ID,无法同步信息至开放系统!";
         return false;
     }
     $basInfoSta = $developerMod->getDeveloper("*", "id = " . $dpId);
     if (!empty($basInfoSta)) {
         $sendInfor = array("username" => $basInfoSta[0]['app_key'], "password" => $basInfoSta[0]['login_pwd'], "token" => $basInfoSta[0]['token'], "groupid" => 10, "email" => $basInfoSta[0]['email'], "mobile" => $basInfoSta[0]['phone'], "qq" => '', "address" => $basInfoSta[0]['address2'] . " " . $basInfoSta[0]['address'], "company" => $basInfoSta[0]['company'], "status" => $basInfoSta[0]['status'], "regtime" => $basInfoSta[0]['create_time'], "regip" => '', "logintime" => '', "loginip" => '');
     } else {
         self::$errMsg[10131] = get_promptmsg(10131, '分销商');
         return false;
     }
     $synStatus = array();
     //开始同步到开放系统 外网
     include_once WEB_PATH . 'lib/service/http.php';
     $http = new Http('http://idc.open.valsun.cn/admin_open/openInterface.php');
     $http->addPostParam(array('distributionBasicInfor' => json_encode($sendInfor)));
     $http->addHeader("Author:zoujunrong");
     if (!$http->post()) {
         //如果是javascript请求,输出是给javascript的,可能就需要对输出转码
         self::$errMsg[10145] = get_promptmsg(10145, $http->err_str);
         return false;
     } else {
         // 			echo $http->getResponse('header')."---header<br/>";
         $synStatus["outOpenSystem"] = $http->getContent();
     }
     //开始同步到开放系统 外网
     $http->setURL('http://open.valsun.cn:88/admin_open/openInterface.php');
     $http->addPostParam(array('distributionBasicInfor' => json_encode($sendInfor)));
     $http->addHeader("Author:zoujunrong");
     if (!$http->post()) {
         //如果是javascript请求,输出是给javascript的,可能就需要对输出转码
         self::$errMsg[10146] = get_promptmsg(10146, $http->err_str);
         return false;
     } else {
         // 			echo $http->getResponse('header')."---header<br/>";
         $synStatus["innerOpenSystem"] = $http->getContent();
     }
     return $synStatus;
 }
开发者ID:bizonix,项目名称:sailvan,代码行数:43,代码来源:apiIntegration.action.php

示例3: quickGet

 static function quickGet($url)
 {
     $bits = parse_url($url);
     $host = $bits['host'];
     $port = isset($bits['port']) ? $bits['port'] : 80;
     $path = isset($bits['path']) ? $bits['path'] : '/';
     if (isset($bits['query'])) {
         $path .= '?' . $bits['query'];
     }
     $client = new Http($host, $port);
     if (!$client->get($path)) {
         return false;
     } else {
         return $client->getContent();
     }
 }
开发者ID:zzzzzmh,项目名称:KeywordFilteringService,代码行数:16,代码来源:Http.php


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