2011-03-30 59 views

回答

2

我不確定你爲什麼想這樣做從PHP,但看看在電子郵件犛牛項目'Send Email' manual page

您將需要使用PHPs curl extension以使用適當的頭文件和PHP本機json_encode() function進行HTTP請求,以串行化您發送的數據。從jonasjohn.de

一個非常簡單的例子捲曲,讓你去:

功能curl_download($網址){

// is cURL installed yet? 
if (!function_exists('curl_init')){ 
    die('Sorry cURL is not installed!'); 
} 

// OK cool - then let's create a new cURL resource handle 
$ch = curl_init(); 

// Now set some options (most are optional) 

// Set URL to download 
curl_setopt($ch, CURLOPT_URL, $Url); 

// Set a referer 
curl_setopt($ch, CURLOPT_REFERER, "http://www.example.org/yay.htm"); 

// User agent 
curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0"); 

// Include header in result? (0 = yes, 1 = no) 
curl_setopt($ch, CURLOPT_HEADER, 0); 

// Should cURL return or print out the data? (true = return, false = 

打印) curl_setopt($ CH,CURLOPT_RETURNTRANSFER,真正的);

// Timeout in seconds 
curl_setopt($ch, CURLOPT_TIMEOUT, 10); 

// Download the given URL, and return output 
$output = curl_exec($ch); 

// Close the cURL resource, and free system resources 
curl_close($ch); 

return $output; 

}