当前位置: 首页>>代码示例>>PHP>>正文


PHP HTTPClient::Fetch方法代码示例

本文整理汇总了PHP中HTTPClient::Fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTPClient::Fetch方法的具体用法?PHP HTTPClient::Fetch怎么用?PHP HTTPClient::Fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTTPClient的用法示例。


在下文中一共展示了HTTPClient::Fetch方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: HTTPClient

 function testNET_HTTP_HTTPClient()
 {
     $robot = new HTTPClient();
     // connect to url
     $res = $robot->Fetch("http://webta.net");
     $this->assertTrue($res, "Can't fetch url");
     /* end of tests */
 }
开发者ID:jasherai,项目名称:libwebta,代码行数:8,代码来源:tests.php

示例2: 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

示例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

示例4: 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

示例5: SendRequest

		private function SendRequest($request)
		{
		    $HTTPClient = new HTTPClient();
		    $params = array("APACScommand" => "NewRequest", "Data" => $request);		    
		    
		    return $HTTPClient->Fetch($this->URL, $params, true);
		}
开发者ID:rchicoria,项目名称:epp-drs,代码行数:7,代码来源:class.ProxyPay3Driver.php


注:本文中的HTTPClient::Fetch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。