Я делаю следующее с помощью Curl:
$authentication = $_POST['username'] . ':' . $_POST['passwd'];
$params = array(
'id' => '12',
'field1' => 'field1text',
'field2' => 'field2text',
'field3' => 'field3text',
'screenshots' => 'screenshots',
'videoLinks' => 'videoLinks'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.domain.com/scripts/curl/index_curl_general.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt($ch, CURLOPT_POST, true );
curl_setopt($ch, CURLOPT_USERPWD,$authentication);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_REFERER,'http://www.domain.com.au');
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
$result = curl_exec($ch);
curl_close($ch);
echo $result;
Я вижу, что могу видеть имя пользователя и пароль с этим кодом - на стороне сервера в index_curl_index.php
print $_SERVER['PHP_AUTH_USER'];
print $_SERVER['PHP_AUTH_PW'];
Но мне кажется, я могу видеть данные $params
.Я пробовал следующее:
var_dump($_POST);
print_r($_POST);
, но оно всегда отображается как пустой массив.Как я могу показать эти данные?и есть ли лучший способ передать эти данные?