本文整理汇总了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());
}
示例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;
}