當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Curl::setopt_array方法代碼示例

本文整理匯總了PHP中Curl::setopt_array方法的典型用法代碼示例。如果您正苦於以下問題:PHP Curl::setopt_array方法的具體用法?PHP Curl::setopt_array怎麽用?PHP Curl::setopt_array使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Curl的用法示例。


在下文中一共展示了Curl::setopt_array方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testCurlWrapperCanDoHttpQueries

 function testCurlWrapperCanDoHttpQueries()
 {
     $curl = new Curl(self::TEST_VALID_URL);
     $curl->setopt(CURLOPT_PROXY, $this->proxy);
     $this->assertTrue($curl->setopt(CURLOPT_RETURNTRANSFER, 1));
     $this->assertTrue($curl->setopt_array(array(CURLOPT_TIMEOUT => self::CURL_TIMEOUT, CURLOPT_FOLLOWLOCATION => true)));
     $result = $curl->exec();
     $this->assertStringStartsWith('<!doctype html>', $result);
     $curl->close();
     $this->assertFalse($curl->hasHandle());
 }
開發者ID:schwarer2006,項目名稱:wikia,代碼行數:11,代碼來源:CurlTest.php

示例2: getComments

 /**
  *
  * Return case's comments; I assume that there wouldn't be single requests for events of more than 1 case
  * (comments should be show when user clicks on proper button
  * Important: Function is not ready and not used yet.
  * that might be corrected/developed in future
  * 
  * THIS NO WORK !!!
  * THIS NO WORK !!!
  * 
  * @param int $caseID
  */
 public function getComments($caseID)
 {
     $res = 'No comments for this case.';
     $this->resetParams();
     $this->setParam('cmd', 'search');
     $this->setParam('token', $this->token);
     $this->setParam('q', $caseID);
     $this->setParam('cols', 'events');
     $this->curl->setopt_array($this->getCurlOptions());
     $xml = $this->curl->exec();
     if (!empty($xml)) {
         $dom = new DOMDocument();
         $dom->loadXML($xml);
         //$case = $dom->getElementsByTagName( 'case' );
         $events = $dom->getElementsByTagName('event');
         //->item(0)->nodeValue;
         unset($res);
         $res = array();
         foreach ($events as $event) {
             $res[] = array('ixPerson' => $event->getElementsByTagName('ixPerson')->item(0)->nodeValue, 'sPerson' => $event->getElementsByTagName('sPerson')->item(0)->nodeValue, 'ixPersonAssignedTo' => $event->getElementsByTagName('ixPersonAssignedTo')->item(0)->nodeValue, 'dt' => $event->getElementsByTagName('dt')->item(0)->nodeValue, 'evtDescription' => $event->getElementsByTagName('evtDescription')->item(0)->nodeValue, 'sChanges' => $event->getElementsByTagName('sChanges')->item(0)->nodeValue);
         }
     }
     return $res;
 }
開發者ID:schwarer2006,項目名稱:wikia,代碼行數:36,代碼來源:FogbugzService.class.php


注:本文中的Curl::setopt_array方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。