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


PHP Curl::start方法代码示例

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


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

示例1: start

 public function start()
 {
     $content = parent::start();
     // false means cURL failed
     if ($content === false) {
         throw new Exception('cURL error: ' . $this->getErrorMessage());
     }
     // anything else than status code 2xx is most likely bad
     $iHttpCode = $this->getHttpCode();
     if ($iHttpCode < 200 || $iHttpCode > 299) {
         throw new Exception('Server error: ' . HttpHeader::getHttpCodeString($iHttpCode));
     }
     return $content;
 }
开发者ID:fedyamaslov1987,项目名称:steamprofile,代码行数:14,代码来源:HttpLoader.class.php

示例2: start

 public function start()
 {
     $content = parent::start();
     // false means cURL failed
     if ($content === false) {
         throw new Exception('cURL error: ' . $this->getErrorMessage());
     }
     // anything else than status code 2xx is most likely bad
     $iHttpCode = $this->getHTTPCode();
     if ($iHttpCode < 200 || $iHttpCode > 299) {
         throw new Exception('Server error: ' . HTTPHeader::getHTTPCodeString($iHttpCode));
     }
     // check if the we actually downloaded anything
     if (strlen($content) == 0) {
         throw new Exception('Empty profile data');
     }
     // trim extra profile data (groups, friends, most played games)
     if ($this->bTrimExtra) {
         $sEndToken = '</summary>';
         $iEndPos = strpos($content, $sEndToken);
         if ($iEndPos !== false) {
             $content = substr($content, 0, $iEndPos + strlen($sEndToken));
             $content .= "\n</profile>";
         }
     }
     // remove certain control characters that are misleadingly send by the API,
     // which are invalid in XML 1.0
     if ($this->bFilterCtlChars) {
         $aCtlChr = array();
         for ($i = 0; $i < 32; $i++) {
             // tab, lf and cr are allowed
             if ($i == 9 || $i == 10 || $i == 13) {
                 continue;
             }
             $aCtlChr[] = chr($i);
         }
         $content = str_replace($aCtlChr, '', $content);
     }
     return $content;
 }
开发者ID:vulcandth,项目名称:steamprofile,代码行数:40,代码来源:SteamProfileLoader.php


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