Home > Backend Development > PHP Tutorial > PHP calls http interface

PHP calls http interface

WBOY
Release: 2016-07-25 08:45:44
Original
2276 people have browsed it
  1. //http request interface
  2. function curl_http_request($param,$url)
  3. {
  4. $ch = curl_init();
  5. $curl_url = $url."?".$param;
  6. curl_setopt($ch, CURLOPT_URL , $curl_url);
  7. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); //Disable certificate
  8. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  9. curl_setopt ($ch, CURLOPT_HEADER, 0); //Header file information for data flow Output
  10. curl_setopt($ch, CURLOPT_POST, 1);
  11. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//Do not output directly, return to variable
  12. $curl_result = curl_exec($ch);
  13. curl_close($ch);
  14. return $curl_result;
  15. }
Copy code

PHP, http


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template