jojo's blog--快樂憂傷都與你同在
          為夢想而來,為自由而生。 性情若水,風起水興,風息水止,故時而激蕩,時又清平……
          posts - 11,  comments - 30,  trackbacks - 0
          <?php
          /*
          * Created on Feb 12, 2008
          *
          * Donald J. Ankney
          * Academic Personnel Information Services
          * ankneyd@u.washington.edu
          *
          * Class is a REST webservice client
          * can use SSL
          *
          */


          class RestClient {
          public $certPath;
          public $keyPath;
          public $uriBase;

          // Method pulls the resource via curl and returns a string of the resource
          function getResource ($uri) {
          $ch = curl_init($this->uriBase.$uri);
          curl_setopt($ch, CURLOPT_HEADER, 0);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
          //TODO: VERIFYPEER is necessary for enterprise use, implement some rules around it
          curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
          if ($this->keyPath AND $this->certPath) { // if cert/key attributes are set, use them
          curl_setopt($ch, CURLOPT_SSLCERT, $this->certPath);
          curl_setopt($ch, CURLOPT_SSLKEY, $this->keyPath);
          }

          $resource=curl_exec($ch);
          $info = curl_getinfo($ch);
          if ($info1 != '200') {
          //TODO: Better error handling
          return FALSE;
          };
          curl_close($ch);
          return $resource;
          }
          }

          $webQ = new RestClient;
          $webQ->uriBase = ';
          $webQ->certPath = '/Path/to/cert.pem';
          $webQ->keyPath = '/Path/to/key.pem';

          $result = $webQ->getResource("/survey/number");//Or whatever you need do construct to pull the data
          if ($result) {
          //Do something with the resource
          } else {
          //TODO: Better error handling
          echo "ERROR: http transfer problem";
          }

          ?>

          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(6)

          隨筆檔案

          文章分類

          文章檔案

          新聞分類

          新聞檔案

          相冊

          收藏夾

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 武胜县| 伽师县| 彩票| 玉田县| 邮箱| 屯昌县| 海门市| 三穗县| 杭州市| 宜春市| 博罗县| 同仁县| 临西县| 朝阳区| 敦化市| 安徽省| 鱼台县| 繁昌县| 乌海市| 瓦房店市| 团风县| 榆树市| 金门县| 辽中县| 庄浪县| 康定县| 石门县| 东乌珠穆沁旗| 陆良县| 青州市| 航空| 西峡县| 勃利县| 施甸县| 徐汇区| 汕头市| 锦屏县| 临西县| 靖江市| 平和县| 钟山县|