色www,五月婷婷深爱五月,午夜国产一级片,色噜噜综合,国产大胸无码视频,清纯美女被操黄网站在线观看,波多野结衣av高清一区二区三区

php的curl實(shí)現(xiàn)get和post的代碼

時(shí)間:2025-11-12 15:37:07 php語(yǔ)言

php的curl實(shí)現(xiàn)get和post的代碼

  類(lèi)似于dreamhost這類(lèi)主機(jī)服務(wù)商,是顯示fopen的使用的。使用php的curl可以實(shí)現(xiàn)支持FTP、FTPS、HTTP HTPPS SCP SFTP TFTP TELNET DICT FILE和LDAP。具體使用如下,更多消息請(qǐng)關(guān)注應(yīng)屆畢業(yè)生網(wǎng)!
  curl 支持SSL證書(shū)、HTTP POST、HTTP PUT 、FTP 上傳,kerberos、基于HTT格式的上傳、代理、cookie、用戶+口令證明、文件傳送恢復(fù)、http代理通道就最常用的來(lái)說(shuō),是基于http的get和post方法。
  代碼實(shí)現(xiàn):
  1、http的get實(shí)現(xiàn)
  代碼如下:
  ?
  $ch = curl_init("/pic/") ;curl_setopt($ch, CURLOPT_RETURNTRANSFER, true) ;curl_setopt($ch, CURLOPT_BINARYTRANSFER, true) ;$output = curl_exec($ch) ;$fh = fopen("out.html", 'w') ;fwrite($fh, $output) ;
  fclose($fh) ;
  2、http的post實(shí)現(xiàn)
  代碼如下:
  ?
  /pic/div>
  extract($_POST) ;
  /pic/div>
  $url = '/pic/get-post.php' ;$fields = array('lname'=>urlencode($last_name) ,'fname'=>urlencode($first_name) ,
  'title'=>urlencode($title) ,
  'company'=>urlencode($institution) ,
  'age'=>urlencode($age) ,
  'email'=>urlencode($email) ,
  'phone'=>urlencode($phone)
  );
  /pic/div>
  foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&' ; }
  rtrim($fields_string ,'&') ;