內容簡介
特點
Include URL 是一個 WordPress 外掛程式,可無縫包含遠端 URL 的資料,可選擇性地傳遞 GET 參數到該 URL。
取得遠端 URL 內容
將指定的 GET 參數傳遞到 URL
本地快取取回的內容在 WordPress 資料庫中(適用於極慢的來源)
用法
[include-url href="<URL>" params="param1,param2,param3..." timeout="seconds" cache="seconds" allow-file="1" allow-shortcode="1"]
href –以 http:// 或 https:// 開頭的 URL(必填)
params –以逗號分隔的 GET 參數列表,應傳遞到包含 URL 中
timeout – 請求逾時時間(單位:秒)
cache – 在 WordPress 資料庫中本地快取請求資料(預設 = 0 秒 / 已停用)
allow-file – 允許 href 中的 file:// URL(預設 = 0 / 已停用,1 = 在檔案開頭加上文件根目錄,2 = 使用絕對路徑)
allow-other – 允許 cURL 支援的任何其他協議
allow-shortcode – 允許並處理包含內容中的 WordPress 簡碼
範例
在前端頁面搜索 SOLR
[include-url href=”http://localhost:8080/solr/core1/select?wt=xslt&wt=results.xslt” params=”q,fq” cache=”1800″]
這會從本機 SOLR 實例請求資料,該實例將通過其 XSLT 處理器格式化搜尋結果,例如 HTML(即表格),可選擇性地傳遞 q (查詢)和 fq (篩選器)參數到該實例。資料將在 WordPress 資料庫中快取 1800 秒。
讀取文件從根目錄
[include-url href=”file://robots.txt” allow-file=”1″]
使用絕對路徑指定要讀取的文件
[include-url href=”file:///var/www/html/robots.txt” allow-file=”2″]
外掛標籤
開發者團隊
原文外掛簡介
Features
Include URL is a WordPress plugin for seamless inclusion of data from remote urls, optionaly passing GET parameters to it..
Get remote url content
Pass given GET params to url
Cache fetched content localy in WordPress DB (for extremely slow sources)
Usage
[include-url href="
href – url starting with http:// or https:// (required)
params – list of comma separated GET parameters, that should be passed to include url
timeout – request timeout in seconds
cache – cache request data localy in wordpress database (default = 0 seconds / disabled)
allow-file – allow file:// urls in href (default = 0 / disabled, 1 = prepend file with document root, 2 = use absolute path)
allow-other – allow any other protocol supported by cURL
allow-shortcode – allow and process wordpress shortcodes in included content
Examples
Search frontend page for SOLR
[include-url href=”http://localhost:8080/solr/core1/select?wt=xslt&wt=results.xslt” params=”q,fq” cache=”1800″]
This requests data from local SOLR instance, that will return search results formated as HTML (ie. table) via its XSLT handler, optionally passing q (query) and fq (filter) params to it. Data will be cached for 1800 seconds in WordPress database.
Read file from document_root
[include-url href=”file://robots.txt” allow-file=”1″]
Read file specified by absolute path
[include-url href=”file:///var/www/html/robots.txt” allow-file=”2″]
