"일꾼이 일을 잘하려면 먼저 도구를 갈고 닦아야 한다." - 공자, 『논어』.
첫 장 > 프로그램 작성 > Curl을 사용하여 게시물 데이터를 웹 페이지로 보낼 수 있습니까?

Curl을 사용하여 게시물 데이터를 웹 페이지로 보낼 수 있습니까?

2025-03-22에 게시되었습니다
검색:105

How Can I Send POST Data to Web Pages Using cURL?

솔루션 :

$ data = array ( 'name'=> 'ross', 'php_master'=> true); // @로 접두사로 파일을 게시 할 수 있습니다 ( fields) $ data

= '@/home/user/world.jpg'; $ hone = curl_init ($ url); curl_setopt ($ hands, curlopt_post, true); curl_setopt ($ hands, curlopt_postfields, $ data); curl_exec ($ 핸들); curl_close ($ hands);

설명 :
$data = array('name' => 'Ross', 'php_master' => true);

// You can POST a file by prefixing with an @ (for  fields)
$data['file'] = '@/home/user/world.jpg';

$handle = curl_init($url);
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
curl_exec($handle);
curl_close($handle);

  • 인코딩 옵션 : [curl_setopt] (https://www.php.net/manual/en/function.curl-setopt.php)
최신 튜토리얼 더>

부인 성명: 제공된 모든 리소스는 부분적으로 인터넷에서 가져온 것입니다. 귀하의 저작권이나 기타 권리 및 이익이 침해된 경우 자세한 이유를 설명하고 저작권 또는 권리 및 이익에 대한 증거를 제공한 후 이메일([email protected])로 보내주십시오. 최대한 빨리 처리해 드리겠습니다.

Copyright© 2022 湘ICP备2022001581号-3