Search Results for ‘CURL’
Jul 8th, 2006 by song

curl用法:cookie及post
一、cookie用法

[code]<?php
$cookie_jar = tempnam('./tmp','cookie');
// login
$c=curl_init('http://login_url?username=xiaxiaobao&password=xiaxiaobao');
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_COOKIEJAR, $cookie_jar);
curl_exec($c);
curl_close($c);
 
$c="url";
$c=curl_init($c);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_COOKIEFILE, $cookie_jar);
curl_exec($c);
curl_close($c);
?>[/code]二、post用法
特别要注意:post的数据要经过urlencode编码
Read the rest of this entry »

几个时间处理函数DELPHI
Jul 7th, 2006 by song

DateTimeToUnix()转化为UNIX时间戳
DateTostr()
TimeToStr()
DateTimeToStr()

Delphi 中的MD5实现方法
Jul 7th, 2006 by song

在Delphi自带的Indy控件中其实是提供了MD2,MD4,MD5对象的,我们可以直接使用它们来完成MD5的签名算法。而不需要再去找其它的DLL或是Pas了。
在Uses单元中引用 IdHashMessageDigest,IdGlobal, IdHash 单元,再写如下代码即可以达到MD5的实现。

示例代码

[code]procedure TForm1.Button1Click(Sender: TObject);
var
 MyMD5: TIdHashMessageDigest5;
 Digest: T4x4LongWordRecord;
begin
 MyMD5 := TIdHashMessageDigest5.Create;
 Digest := MyMD5.HashValue('');
 ShowMessage('32: ' + MyMD5.AsHex(Digest));  //显示32个字符长度的MD5签名结果
 ShowMessage('16: ' + Copy(MyMD5.AsHex(Digest), 9, 16));   //显示16个字符长度的MD5签名结果
end;[/code]
说明:
  MyMD5.HashValue 函数中可以是一个字符串或是一个流对象,它返回的结果类型为 T4x4LongWordRecord 的MD5签名后结果
  MyMD5.AsHex  函数是将T4x4LongWordRecord的Md5签名转换成为十六进制的MD5签名字符串。

delphi 7的TSeverSocket和TClientSocket组见哪里去了
Jul 7th, 2006 by song

Borland is deprecating the use of the TServerSocket
   and TClientSocket from the unit ScktComp. It is
   recommended that you use the Indy components for
   socket operations. The TServerSocket and
   TClientSocket will no longer be installed on the
   component palette by default. If you require the
   use of these components then you can install
   the design time package named dclsockets70.bpl,
   found in your bin directory. For deployment with
   runtime packages, you will need to deploy rtl70.bpl
   and any other required packages
偶简单翻译了一下:TClientSocket 本来是D5默认安装的,但是D7使用的Indy组件后,就没有默认安装了,如果你喜欢这个组件,可以在D7的安装目录bin文件夹找到dclsockets70.bpl组件包,安装上去就OK了.rtl70.bpl是TCientSocket和TServerSocket必需的运行包.

PHP socket SMTP邮件类
Jul 5th, 2006 by song

[code]<?
class smtp
{
/* Public Variables */
var $smtp_port;
var $time_out;
var $host_name;
var $log_file;
var $relay_host;
var $debug;
var $auth;
var $user;
var $pass;

/* Private Variables */
var $sock;

/* Constractor */
function smtp($relay_host = "", $smtp_port = 25,$auth = false,$user,$pass)
{
$this->debug = FALSE; Read the rest of this entry »

8088 汇编速查手册              
Jul 5th, 2006 by song

8088 汇编速查手册              

一、数据传输指令
───────────────────────────────────────
 它们在存贮器和寄存器、寄存器和输入输出端口之间传送数据.
 1. 通用数据传送指令.
   MOV   传送字或字节.
   MOVSX 先符号扩展,再传送.
   MOVZX 先零扩展,再传送.
   PUSH   把字压入堆栈.
   POP   把字弹出堆栈.
   PUSHA 把AX,CX,DX,BX,SP,BP,SI,DI依次压入堆栈.
   POPA   把DI,SI,BP,SP,BX,DX,CX,AX依次弹出堆栈.
   PUSHAD 把EAX,ECX,EDX,EBX,ESP,EBP,ESI,EDI依次压入堆栈.
   POPAD 把EDI,ESI,EBP,ESP,EBX,EDX,ECX,EAX依次弹出堆栈.
   BSWAP 交换32位寄存器里字节的顺序
   XCHG   交换字或字节.( 至少有一个操作数为寄存器,段寄存器不可作为操作数)
   CMPXCHG 比较并交换操作数.( 第二个操作数必须为累加器AL/AX/EAX )
   XADD   先交换再累加.( 结果在第一个操作数里 )
   XLAT   字节查表转换.
         ── BX 指向一张 256 字节的表的起点, AL 为表的索引值 (0-255,即
         0-FFH); 返回 AL 为查表结果. ( [BX+AL]->AL )
 2. 输入输出端口传送指令. Read the rest of this entry »

SIDEBAR
»
S
I
D
E
B
A
R
«
»  Substance:WordPress   »