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


PHP HTTPClient::SetTimeouts方法代碼示例

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


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

示例1: HTTPClient

 function testData_XML_RSS_RSSReader()
 {
     $http = new HTTPClient();
     // rss 2.0
     $url = 'http://aggressiva.livejournal.com/data/rss';
     $http->SetTimeouts(30, 15);
     $xml = $http->Fetch($url);
     $Reader = new RSSReader();
     $Reader->Parse($xml);
     $data = $Reader->GetData();
     $this->assertTrue($data['channel'], "No channel found");
     $this->assertTrue($data['item']['pubdate'], "No items found");
 }
開發者ID:rchicoria,項目名稱:epp-drs,代碼行數:13,代碼來源:tests.php

示例2: GetBlogEntries

		/**
		 * Get blog entries from myspace account
		 * 
		 * @var int friend account number (if not default)
		 */
		function GetBlogEntries($accountid = 0)
		{
			if (!$accountid) $accountid = $this->AccountID;
			
			$blog_page = sprintf(self::BLOG_ATOM_URL, $accountid);

			$http = new HTTPClient();
			$http->SetTimeouts(60, 30);
			$http->Fetch($blog_page);
			$blog_xml = $http->Result;

			$Reader = new RSSReader();
			$Reader->Parse($blog_xml);
			$data = $Reader->GetData();

			if (!$data) 
				return false;
			
			$blogs = array();
			
			foreach($data['item']['title'] as $key => $subject)
			{
				$timestamp = strtotime($data['item']['published'][$key]);
				
				array_push($blogs, array(
					'date'		=> date("Y-m-d", $timestamp),
					'subject'	=> $subject,
					'category'	=> "",
					'content'	=> $data['item']['content'][$key],
					'time'		=> date("H:i", $timestamp),
					'comments'	=> "",
					'timestamp' => $timestamp
				));
				
			} 
			
			return $blogs;
			
		}
開發者ID:rchicoria,項目名稱:epp-drs,代碼行數:44,代碼來源:class.Blogger.php

示例3: GetBlogEntries

		/**
		 * Get blog entries from myspace account
		 * 
		 * @var int friend account number (if not default)
		 */
		function GetBlogEntries($accountid)
		{
			if (!$accountid) $accountid = $this->AccountID;
			
			$blog_page = sprintf(self::BLOG_URL, $accountid);
			
			$http = new HTTPClient();
			$http->SetTimeouts(60, 30);
			$http->Fetch($blog_page);
			
			if (preg_match("/<title>[^<]*302 Found[^<]*<\/title>/msi", $http->Result))
			{
				$blog_page = sprintf(self::BLOG_URL_SIMPLE, $accountid);
				
				$http = new HTTPClient();
				$http->SetTimeouts(60, 30);
				$http->Fetch($blog_page);
			}
			
			$blog_xml = $http->Result;
			
			$Reader = new RSSReader();
			$Reader->Parse($blog_xml);
			$data = $Reader->GetData();

			if (!$data) 
				return false;
			
			$blogs = array();
			
			foreach((array)$data['item']['title'] as $key => $subject)
			{
				$timestamp = strtotime($data['item']['pubdate'][$key]);
				
				array_push($blogs, array(
					'date'		=> date("Y-m-d", $timestamp),
					'subject'	=> $subject,
					'category'	=> "",
					'content'	=> $data['item']['description'][$key],
					'time'		=> date("H:i", $timestamp),
					'comments'	=> "",
					'timestamp' => $timestamp
				));
				
			} 
			
			return $blogs;
			
		}
開發者ID:rchicoria,項目名稱:epp-drs,代碼行數:54,代碼來源:class.LiveJournal.php


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