Author Archives: admin

curl download files with the file name from server

To download files with the file name from server with curl, you need to specify this command:
curl -O -J -L

And this is the explanation of the command switch used:
-O, –remote-name Write output to a file named as the remote file
-J, –remote-header-name Use the header-provided filename (H)
-L, –location Follow redirects (H)

get rid of weird #text when you load a xml document into php DOMDocument

When you load a xml file into DOMDocument in php, you can encounter some weired #text node during the iteration. I searched around, and found this solution, just put a line of code like below:
$dom = new DOMDocument;
$dom->preserveWhiteSpace = FALSE;

And then you are done!

And last not least this is where I found the answer, it gives a thoroughly explanation:

http://stackoverflow.com/questions/4598409/printing-content-of-a-xml-file-using-xml-dom

build openvpn from command line

first download the source and cd to the extracted directory, you should run follow commands:

wget http://swupdate.openvpn.org/community/releases/openvpn-2.3.4.tar.gz
tar -zxvpf openvpn-2.3.4.tar.gz
cd openvpn-2.3.4
aptitude install libssl-dev liblzo2-dev libpam0g-dev gcc make -y
./configure
make
make install