问题描述:

I'm using the following CURL Call and its transfer successfully.

I've tried to send an encrypted key - which changes with each encrypted (using AES) but looks something like this: cpZa˜Hó”™itz²÷ðt?=þ|w±I†ïÛì„¡

I've been told I need to use base64 - have tried utf8_encode below.

How do I use base64?

Is this an option added to CURL or something encoded and decoded in PHP?

 $data = array('validation' => '1', 'encryptkey' => utf8_encode($encryptedDate));

//utf8_encode()

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'http://www.domain.com/this.php');

curl_setopt($ch, CURLOPT_FAILONERROR, true);

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,$_SESSION['domainname']);

curl_setopt($ch, CURLOPT_POSTFIELDS,$data);

$result = curl_exec($ch);

curl_close($ch);

echo $result;

网友答案:

Use base64_encode().

Simply swap utf8_encode() with base64_encode().

相关阅读:
Top