2009-06-08 58 views

回答

3

看看這個線程它與你想做的事我什麼交易認爲:http://www.webmasterworld.com/php/3164561.htm

中的最後一項可能的幫助(由我重新格式化):

function do_post_request($url, $data, $optional_headers = null) { 
    $params = array('http' => array( 
    'method' => 'post', 
    'content' => $data 
)); 

    if ($optional_headers!== null) 
    $params['http']['header'] = $optional_headers; 

    $ctx = stream_context_create($params); 
    $fp = @fopen($url, 'rb', false, $ctx); 
    if (!$fp) 
    throw new Exception("Problem with $url, $php_errormsg"); 

    $response = @stream_get_contents($fp); 
    if ($response === false) 
    throw new Exception("Problem reading data from $url, $php_errormsg"); 

    return $response; 
} 

基本上解決方案利用內置的php流處理的網址。

+0

非常好。我會研究這個解決方案。 – 2009-06-09 15:46:40

相關問題