Categories
- FFMpeg (5)
- Libav (1)
- Google (3)
- iBeacon (1)
- LDAP (3)
- Me (2)
- Network (11)
- OS (149)
- RTMP (4)
- SIP (1)
- Kamailio (1)
- SNMP (1)
- VMware (20)
- VCP考試 (1)
- 伺服器 網站服務 (105)
- 名詞解釋 (4)
- 專案管理 (1)
- 工具軟體 (50)
- Adobe (1)
- FMS (1)
- Cloudera (1)
- Docker (1)
- Eclipse (4)
- Intellij (2)
- OBS (2)
- Office (10)
- Excel (4)
- PowerPoint (5)
- Postman (1)
- Splunk (13)
- Virtualbox (2)
- Visual Studio (2)
- 文字編輯器 (10)
- Sublime Text 2 (6)
- Sublime Text 3 (3)
- Vim (3)
- 連線工具 (1)
- Xshell (1)
- Adobe (1)
- 程式語言 (79)
- CSS (2)
- HTML (2)
- iOS (1)
- Java (30)
- JavaScript (5)
- jQuery (4)
- jsTree (2)
- JSP (3)
- PHP (16)
- Python (7)
- Ruby (1)
- sed (1)
- Shell Script (8)
- Windows Bash Script (1)
- XML (1)
- 資料庫 (37)
- FFMpeg (5)
Category Archives: PHP
[PHP] Output debug information to console
echo “<script>console.log( ‘Debug Objects: ” . $data . “‘ );</script>”; Ref. stackoverflow: How can I write to console in PHP?
Posted in PHP
Leave a comment
OBS – Get Active Publish Streaming
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <!--使用html格式輸出--> <xsl:template match="stream"> <!--抓取stream template的內容--> <table> <tr id="cowtr"> <td id="cowtd"> <!--這邊只是為了給後續php parse表格內容時的tag--> <xsl:choose> <xsl:when test="active"> <!--當狀態是active的時候,即為publish狀態--> <xsl:value-of select="name"/> <!--只抓取名稱--> </xsl:when> </xsl:choose> </td> </tr> </table> </xsl:template> </xsl:stylesheet> |
然後再使用php進行parse去除不必要的資訊
1 2 3 4 5 6 7 8 9 10 |
<?php include_once('simple_html_dom.php'); #這邊的simple_html_dom.php是到http://sourceforge.net/projects/simplehtmldom/files/ 進行下載 $cowdata=file_get_html("http://10.9.50.53/streamlist"); #將html抓回成html dom物件 foreach($cowdata->find('td') as $element){ #尋找介於td內的資料 echo "<client>".$element->plaintext . "</client>n"; } ?> |
Posted in OBS, PHP, XML
Leave a comment
Eclipse 安裝 PHP 模組
環境:Eclipse Version: Luna Service Release 1 (4.4.1) 開啟Eclipse => Help => Install New Software Work with 選擇 Luna – http://download.eclipse.org/releases/luna 展開 Web, XML, Java EE and OSGi Enterprise Development 勾選PHP Development Tools (PDT) => Next => 安裝 安裝完畢後重新啟動即可
Posted in Eclipse, PHP
Leave a comment
Sublime Text 2 install PHP-Beautifier
環境:Windows 7 x64 安裝 PHP 1.1 http://windows.php.net/download/,選擇Installer最新版本下載安裝 1.2 將PHP安裝路徑加至Windows系統環境變數Path內 安裝php pear 2.1 下載http://pear.php.net/go-pear.phar至PHP目錄下 2.2 使用命令提示字元(以系統管理者啟動),切換至PHP目錄,輸入php go-pear.phar進行安裝 2.3 PHP目錄下會產生Pear_ENV.reg檔案,將它加入至系統內 PHP安裝PHP_Beautifier 3.1 在PHP目錄下,輸入pear install PHP_Beautifier-0.1.15進行安裝 3.2 修改PHP目錄下的php_beautifier,將error_reporting(E^ALL)修改為error_reporting(0),大約在第55行 3.3 修改PHP目錄下的php_beautifier.bat,將所有的改為/ 3.4 修改PHPpearPHPBeautifierFilter目錄下的Pear.filter.php及phpBB.filter.php,將require_once (‘PEAR/Config.php’);註解 Sublime Text 2安裝PHP_beautifier 4.1 Sublime Text 2安裝Package Control,進入Console模式(ctrl+`),輸入import urllib2,os; pf=’Package … Continue reading
Posted in PHP, Sublime Text 2
Leave a comment
Post 檔案至Web CGI
第一種方式,linux curl command
1 |
curl -vv --cookie "Session=798434368" --data-binary @RoxioMediaManager_test4_AAC-LC_v4_Stereo_CBR_64kbps_44100Hz_ok.aac http://192.168.251.156/CGI/MobileAudio |
第二種方式,PHP cUrl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
<?php require_once 'global.php'; //global.php提供session、url的設定值 function mobileAudio() { $local_directory=dirname(__FILE__).'/'; //指定檔案目錄 $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_VERBOSE, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)"); curl_setopt($ch, CURLOPT_COOKIE, 'Session=' . $GLOBALS['Session']); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_URL, $url ); $post_array = array( "my_file"=>"@".$local_directory.$_GET['file'], //利用get取得檔案名稱 "upload"=>"Upload" ); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_array); $response = curl_exec($ch); curl_close($ch); var_dump('$response:'); var_dump($response); } mobileAudio(); |
Posted in PHP
Leave a comment
PHP 下拉檔案選單
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<?php $filetypes = array("wav", "aac"); //設定要秀出的副檔名 echo "<select name='file'>n"; foreach (new DirectoryIterator('/var/www/b30_bak') as $file) { //指定web server上的路徑位置 $filetype = pathinfo($file, PATHINFO_EXTENSION); if (in_array(strtolower($filetype), $filetypes)) { //如果符合副檔名設定才秀出來 echo '<option>' . htmlentities($file) . "</option>n"; } } echo '</select><br/>'; ?> |
Posted in PHP
Leave a comment
PHP強迫輸出
Source: http://php.net/manual/en/function.ob-flush.php some problems with ob_flush() and flush() could be resolved by defining content type header : header( ‘Content-type: text/html; charset=utf-8’ ); so working code looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 |
<?php header( 'Content-type: text/html; charset=utf-8' ); echo 'Begin ...<br />'; for( $i = 0 ; $i < 10 ; $i++ ) { echo $i . '<br />'; flush(); ob_flush(); sleep(1); } echo 'End ...<br />'; ?> |
Posted in PHP
Leave a comment
PHP Eclipse Editor
怒了, 還是來裝一下Editor好了 不然vim打得好累…… 參考蛙齋的作法1、蛙齋的作法2 先到官網下載Eclipse軟體安裝後,利用help=>install new software找到『Web, XML, Java EE and OSGi Enterprise Development』項目 在此項目下就可以看到php的相關plugin 然後再安裝rse,主要是可以讓eclipse支援remote操作(ftp、ssh等) rse主要在General Purpose Tools下,需要安裝『Remote System Explorer End-User Runtime、Remote System Explorer User Actions』這兩個 安裝完後便可以利用『Remote System Explorer』設定ssh的連線資訊 設定完成後選擇遠端的網頁目錄按右鍵『Create Remote Project』 這時候便可以用php explorer來瀏覽、編輯網頁 註:我比較懶,且不算是生產線上的系統,所以選擇直接編輯 通常最適當做法應該是在本機創模擬環境,確認ok後再上傳
Posted in PHP
Leave a comment
查詢關鍵字是否存在於以逗號分隔的資料欄位中
這樣有個好處 table的欄位可以開少一點 只是拉出來時如果要個別拆開 就需要程式語言有支援了…. (還有php有支援XD) 只是這邊有一點要小心,逗號前後的空格都有可能會影響比對的部分
Posted in MySQL, PHP
Leave a comment