Forum und email

http_post_fields

(PECL pecl_http:0.10.0-1.5.5)

http_post_fields — Perform POST request with data to be encoded

說明

string http_post_fields ( string $url [, array $data [, array $files [, array $options [, array &$info ]]]] )

Performs an HTTP POST request on the supplied url.

可用參數的完整列表見 http_get() 函式和 選項

參數

url

URL

data

Associative array of POST values

files

Array of files to post

options

請求選項

info

請求/回覆訊息

Return值

成功時以字串回傳 HTTP 回覆訊息,失敗時回傳 FALSE。

範例

Example#1 A http_post_fields() example

<?php
$fields 
= array(
    
'name' => 'mike',
    
'pass' => 'se_ret'
);
$files = array(
    array(
        
'name' => 'uimg',
        
'type' => 'image/jpeg',
        
'file' => './profile.jpg',
    )
);

$response http_post_fields("https://www.example.com/"$fields$files);
?>