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


PHP Varien_Http_Adapter_Curl::setOptions方法代碼示例

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


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

示例1: _setBasicAdapterOptions

 /**
  * Prepare basic options for curl adapter
  *
  * @param int|float|bool $timeout in seconds
  *
  * @return Enterprise_Search_Model_Client_Solr
  */
 protected function _setBasicAdapterOptions($timeout)
 {
     if ($timeout <= 0) {
         $timeout = $this->_defaultTimeout;
     }
     $optionsList = array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_TIMEOUT => (int) $timeout);
     if (strlen($this->getUserLogin()) && strlen($this->getPassword())) {
         $optionsList[CURLOPT_HTTPAUTH] = CURLAUTH_BASIC;
         $optionsList[CURLOPT_USERPWD] = $this->getUserLogin() . ':' . $this->getPassword();
     }
     $this->_curlAdapter->setOptions($optionsList);
     return $this;
 }
開發者ID:hyhoocchan,項目名稱:mage-local,代碼行數:20,代碼來源:Solr.php

示例2: indexAction

 public function indexAction()
 {
     /*$http = new Varien_Http_Adapter_Curl();
     		$cookie = 'cookie.txt';
     		$account = 'nthanhbk@gmail.com'; 
     		$password= 'In311truongchinh';
     		$appIdPrefix = "88X6EP4WFV";
     		
     		$config = array('timeout' => 3000,'verifypeer' => FALSE,'verifyhost' => FALSE);
     		
     		$naAppCodeName = 'Mozilla';
     		$naAppName = 'Netscape';
     		$naAppVersion = '5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36';
     		
     		
     		$options = array(CURLOPT_USERAGENT => "$naAppCodeName/$naAppVersion",
     						CURLOPT_COOKIEJAR => realpath($cookie),
     						CURLOPT_COOKIEFILE => realpath($cookie)
     					);
         	$http->setConfig($config);
     		$http->setOptions($options);
     		
     		
     		//get link login
     		$url = 'https://appleid.apple.com/cgi-bin/WebObjects/MyAppleId.woa/wa/directToSignIn?localang=en_US';
     		$http->write(Zend_Http_Client::GET, $url, '1.1');
     		$content = $http->read();
     		
     		$regex_pattern =  "/id=\"signIn\" name=\"appleConnectForm\" action=\"(.*?)\">/";
     		preg_match($regex_pattern, $content, $match);
     		
     		$url = 'https://appleid.apple.com'.$match[1];
     		
     		$regex_pattern =  "/id=\"fdcBrowserDataId\" type=\"hidden\" name=\"(.*?)\"/";
     		preg_match($regex_pattern, $content, $match);
     		$fdcBrowserDataId = $match[1];
     		
     		$regex_pattern =  "/id=\"actionChosen\" type=\"hidden\" name=\"(.*?)\"/";
     		preg_match($regex_pattern, $content, $match);
     		$actionChosen = $match[1];
     		
     		$regex_pattern =  "/name=\"wosid\" value=\"(.*?)\"/";
     		preg_match($regex_pattern, $content, $match);
     		$wosid = $match[1];
     		
     		$naProductSub = '20030107';
     		$naBrowserLanguage = 'undefined';
     		$naCookieEnabled = 'true';
     		$navigatorOscpu = $naCpuClass = ''; //undefined
     		$naOnLine = 'true';
     		$naPlatform = 'Win32';
     		$naSystemLanguage = 'undefined';
     		$naLanguage = 'en-US';
     		$documentDefaultCharset = 'ISO-8859-1';
     		$documentDomain = 'appleid.apple.com';
     		$screenDeviceXDPI = 'undefined';
     		$screenDeviceYDPI = 'undefined';
     		$screenFontSmoothingEnabled = 'undefined';
     		$screenUpdateInterval = 'undefined';
     		$timeZoneOffset = date('Z')/3600;
     		$date = '6/7/2005 9:33:44 PM';
     		$screenHeight = '768';
     		$screenWidth = '1366';
     		$pluginsAcrobat = '';
     		$pluginsFlashVersion = '13.0';
     		$pluginsQuickTime = '';
     		$pluginsAcrobat = '';
     		$pluginsJava = '10.51.2';
     		$pluginsDirector = '';
     		$pluginsOffice = '2010';
     		$runTime = rand(20, 50);//thoi gian javascript chay den luc nay
     		$offsetHour = -date('Z')/60;
     		$currentTime = date('n/d/Y H:i:s A');
     		$screenColorDepth = 24;
     		$windowScreenSvailLeft = 0;
     		$windowScreenSvailTop = 0;
     		$flash = 'Shockwave Flash%7CShockwave Flash 12.0 r0';
     		$spanOffset = '18';
     		$milisecondTime = round(microtime(true) * 1000);
     		
     		$offsetGmt = date('P');
     		
     		$encodeAppVersion = $naAppVersion;
     		
     		$encodeAppVersion = str_replace(' ', '%20', $encodeAppVersion);
     		$encodeAppVersion = str_replace('(', '%28', $encodeAppVersion);
     		$encodeAppVersion = str_replace(')', '%29', $encodeAppVersion);
     		$encodeAppVersion = str_replace(';', '%3B', $encodeAppVersion);
     		$encodeAppVersion = str_replace(',', '%2C', $encodeAppVersion);
     		
     		$u = "$naAppCodeName/$naAppVersion";
     		$z = "GMT$offsetGmt";
     		$f = "TF1;016;;;;;;;;;;;;;;;;;;;;;;$naAppCodeName;$naAppName;$encodeAppVersion;$naProductSub;"
     			."$naBrowserLanguage;$naCookieEnabled;$navigatorOscpu;$naOnLine;$naPlatform;$naSystemLanguage;"
     			."$naAppCodeName/$encodeAppVersion;$naLanguage;$documentDefaultCharset;$documentDomain;$screenDeviceXDPI;"
     			."$screenDeviceYDPI;$screenFontSmoothingEnabled;$screenUpdateInterval;false;false;$milisecondTime;$timeZoneOffset;"
     			."$date;$screenWidth;$screenHeight;$pluginsAcrobat;$pluginsFlashVersion;$pluginsQuickTime;$pluginsJava;"
     			."$pluginsDirector;$pluginsOffice;$runTime;$offsetHour;$offsetHour;$currentTime;$screenColorDepth;"
     			."$screenWidth;$screenHeight;$windowScreenSvailLeft;$windowScreenSvailTop;;;;;;"
     			."$flash;;;;;;;;;;;;;$spanOffset;;;;;;;";
//.........這裏部分代碼省略.........
開發者ID:Thinlt,項目名稱:simicart,代碼行數:101,代碼來源:TestController.php

示例3: createProvisionFile

 public function createProvisionFile()
 {
     $http = new Varien_Http_Adapter_Curl();
     $cookie = 'cookie.txt';
     $config = array('timeout' => 3000, 'verifypeer' => FALSE, 'verifyhost' => FALSE);
     $options = array(CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36", CURLOPT_COOKIEJAR => realpath($cookie), CURLOPT_COOKIEFILE => realpath($cookie));
     $http->setConfig($config);
     $http->setOptions($options);
     $url = 'https://developer.apple.com/membercenter/index.action';
     $http->write(Zend_Http_Client::POST, $url, '1.1');
     $content = $http->read();
 }
開發者ID:Thinlt,項目名稱:simicart,代碼行數:12,代碼來源:Data.php

示例4: createProvisionFile

 public function createProvisionFile($name, $bundleId)
 {
     //echo $name . $bundleId;die();
     $http = new Varien_Http_Adapter_Curl();
     $cookie = 'cookie.txt';
     $account = 'nthanhbk@gmail.com';
     $password = 'In311truongchinh';
     $appIdPrefix = "88X6EP4WFV";
     $config = array('timeout' => 50000, 'verifypeer' => FALSE, 'verifyhost' => FALSE);
     $options = array(CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36", CURLOPT_COOKIEJAR => realpath($cookie), CURLOPT_COOKIEFILE => realpath($cookie));
     $http->setConfig($config);
     $http->setOptions($options);
     //get link login
     $url = 'https://developer.apple.com/membercenter/index.action';
     $http->write(Zend_Http_Client::GET, $url, '1.1');
     $content = $http->read();
     $pos1 = strpos($content, 'Location:');
     $pos2 = strpos($content, 'Content-Length:');
     $nextUrl = substr($content, $pos1 + 10, $pos2 - $pos1 - 10);
     $http->write(Zend_Http_Client::GET, $nextUrl, '1.1');
     $content = $http->read();
     //login
     // old
     $regex_pattern = "/name=\"appleConnectForm\" action=\"(.*?)\"/";
     preg_match($regex_pattern, $content, $match);
     $postLoginUrl = 'https://daw.apple.com' . $match[1];
     $tempContent = explode('<input type="hidden" name="wosid" value="', $content);
     $tempContent = $tempContent[1];
     $pos1 = strpos($tempContent, '"');
     $wosid = substr($tempContent, 0, $pos1);
     $body = 'theAccountName=' . $account . '&theAccountPW=' . $password . '&wosid=' . $wosid;
     $http->write(Zend_Http_Client::POST, $postLoginUrl, '1.1', NULL, $body);
     $content = $http->read();
     //doashboard
     $url = 'https://developer.apple.com/membercenter/index.action';
     $http->write(Zend_Http_Client::GET, $url, '1.1');
     $content = $http->read();
     //login - new
     if (!strpos($content, 'Your Account')) {
         //not logged in
         $pos1 = strpos($content, 'Location:');
         $pos2 = strpos($content, 'Content-Length:');
         $nextUrl = substr($content, $pos1 + 10, $pos2 - $pos1 - 10);
         $http->write(Zend_Http_Client::GET, $nextUrl, '1.1');
         $content = $http->read();
         $regex_pattern = "/name=\"form2\" action=\"authenticate;jsessionid=(.*?)\"/";
         preg_match($regex_pattern, $content, $match);
         //login
         $url = 'https://idmsa.apple.com/IDMSWebAuth/authenticate;jsessionid=' . $match[1];
         /*	
         $naProductSub = '20030107';
         $naBrowserLanguage = 'undefined';
         $naCookieEnabled = 'true';
         $navigatorOscpu = $naCpuClass = ''; //undefined
         $naOnLine = 'true';
         $naPlatform = 'Win32';
         $naSystemLanguage = 'undefined';
         $naLanguage = 'en-US';
         $documentDefaultCharset = 'ISO-8859-1';
         $documentDomain = 'idmsa.apple.com';
         $screenDeviceXDPI = 'undefined';
         $screenDeviceYDPI = 'undefined';
         $screenFontSmoothingEnabled = 'undefined';
         $screenUpdateInterval = 'undefined';
         $timeZoneOffset = date('Z')/3600;
         $date = '6/7/2005 9:33:44 PM';
         $screenHeight = '768';
         $screenWidth = '1366';
         $pluginsAcrobat = '';
         $pluginsFlashVersion = '13.0';
         $pluginsQuickTime = '';
         $pluginsAcrobat = '';
         $pluginsJava = '10.51.2';
         $pluginsDirector = '';
         $pluginsOffice = '2010';
         $runTime = rand(20, 50);//thoi gian javascript chay den luc nay
         $offsetHour = -date('Z')/60;
         $currentTime = date('n/d/Y H:i:s A');
         $screenColorDepth = 24;
         $windowScreenSvailLeft = 0;
         $windowScreenSvailTop = 0;
         $flash = 'Shockwave Flash%7CShockwave Flash 12.0 r0';
         $spanOffset = '20';
         $milisecondTime = round(microtime(true) * 1000);
         
         $offsetGmt = date('P');
         
         $encodeAppVersion = $naAppVersion;
         
         $encodeAppVersion = str_replace(' ', '%20', $encodeAppVersion);
         $encodeAppVersion = str_replace('(', '%28', $encodeAppVersion);
         $encodeAppVersion = str_replace(')', '%29', $encodeAppVersion);
         $encodeAppVersion = str_replace(';', '%3B', $encodeAppVersion);
         $encodeAppVersion = str_replace(',', '%2C', $encodeAppVersion);
         
         $u = "$naAppCodeName/$naAppVersion";
         $z = "GMT$offsetGmt";
         $f = "TF1;016;;;;;;;;;;;;;;;;;;;;;;$naAppCodeName;$naAppName;$encodeAppVersion;$naProductSub;"
         	."$naBrowserLanguage;$naCookieEnabled;$navigatorOscpu;$naOnLine;$naPlatform;$naSystemLanguage;"
         	."$naAppCodeName/$encodeAppVersion;$naLanguage;$documentDefaultCharset;$documentDomain;$screenDeviceXDPI;"
//.........這裏部分代碼省略.........
開發者ID:Thinlt,項目名稱:simicart,代碼行數:101,代碼來源:Test.php


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