curl CommandLine Uniform Resource Locator
curl_init()
回傳一個 cURL handle
curl_setopt()
為cURL handle設定引數,格式為 CURLOPT_XXX
常用引數:
-
CURLOPT_URL:url
-
CURLOPT_REFERER:Referer提交的頁面
-
CURLOPT_POST:是否是post請求
-
CURLOPT_TIMEOUT:超時時間
-
CURLOPT_HTTPHEADER:head請求資料
-
CURLOPT_HEADER:
-
CURLOPT_SSL_VERIFYPEER:FALSE to stop cURL from verifying the peer's certificate. Alternate certificates to verify against can be specified with the CURLOPT_CAINFO option or a certificate directory can be specified with the CURLOPT_CAPATH option.
-
CURLOPT_SSL_VERIFYHOST:1 to check the existence of a common name in the SSL peer certificate. 2 to check the existence of a common name and also verify that it matches the hostname provided. 0 to not check the names. In production environments the value of this option should be kept at 2 (default value).
-
CURLOPT_RETURNTRANSFER:TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it directly.
-
CURLOPT_POSTFIELDS:post提交資料
curl_exec()
執行請求,如果設定了 CURLOPT_RETURNTRANSFER,成功會回傳結果,失敗回傳false,
curl_close()
關閉
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/56958.html
標籤:PHP
