PHP 페이지에서 일부 데이터를 다른 PHP 페이지로 POST하고 데이터를 다시 가져 오려고합니다. 이유는 아니다PHP로 결과 게시 및 결과 얻기
string(0) ""
:
<?php
// Initialize cURL session
$ch = curl_init('postpage.php');
// Set some options on the session
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('field1' => 'Andrew'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute post
$result = curl_exec($ch);
var_dump($result);
// Close the session
curl_close($ch);
?>
및 postpage.php에
:<?php
echo 'Receipt of post request. field1:'.$_POST["field1"];
?>
모든 위해서 var_dump 나에게주는이 여기있다
내가 현재 가지고있는 것입니다 텍스트를 다시 가져 오는 중입니까?감사합니다.
사용중인 실제 "curl_init()"입니까? 그렇다면 완전한 URL (프로토콜, 호스트 이름, URI)을 사용해야합니다. –