why is the content of $encrypted every time different?
// aquire public key from server
$server_public_key = openssl_pkey_get_public(file_get_contents(\"C:\
The PKCS#1 encryption algorithm uses some random seed to make the cipher-text different every time.
This protects the cipher-text against several attacks, like frequency analysis, ciphertext matching. For example, if you were using a public key to encrypt all your password without randomness. All the same password will yield the same cipher-text. Someone can figure out all the popular passwords by checking the frequency of the cipher-text.
For symmetric key encryption, IV (Initial Vector) serves a similar purpose.