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)

          隨筆檔案

          文章分類

          文章檔案

          新聞分類

          新聞檔案

          相冊

          收藏夾

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 华阴市| 朝阳市| 宁明县| 横山县| 响水县| 松江区| 长岛县| 汾西县| 安阳县| 喀什市| 会昌县| 惠东县| 同仁县| 搜索| 阳泉市| 信阳市| 邵阳县| 易门县| 靖远县| 临西县| 昌黎县| 礼泉县| 南投市| 府谷县| 玉山县| 逊克县| 阳泉市| 云阳县| 嘉祥县| 东海县| 临高县| 武穴市| 海林市| 宕昌县| 南乐县| 开远市| 镇江市| 颍上县| 富顺县| 泽普县| 江源县|