0

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;

1 Answer 1

2

Use base64_encode().

Simply swap utf8_encode() with base64_encode().

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.