關(guān)于“php_curl_轉(zhuǎn)碼”的問題,小編就整理了【1】個(gè)相關(guān)介紹“php_curl_轉(zhuǎn)碼”的解答:
如何使用php中的curl方法向服務(wù)器發(fā)送post請求?用PHP向服務(wù)器發(fā)送HTTP的POST請求,代碼如下:
<?php/** * 發(fā)送post請求 * @param string $url 請求地址 * @param array $post_data post鍵值對數(shù)據(jù) * @return string */ function send_post($url, $post_data) { $postdata = http_build_query($post_data); $options = array( 'http' => array( 'method' => 'POST', 'header' => 'Content-type:application/x-www-form-urlencoded', 'content' => $postdata, 'timeout' => 15 * 60 // 超時(shí)時(shí)間(單位:s) ) ); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); return $result; }
到此,以上就是小編對于“php_curl_轉(zhuǎn)碼”的問題就介紹到這了,希望介紹關(guān)于“php_curl_轉(zhuǎn)碼”的【1】點(diǎn)解答對大家有用。