What am is missing? (API CORS)

Thank you that helped me alot! But there was one more problem and that was the "'Authorization' => 'Basic ', $apiKey," part. I just needed a dot before $apiKey. Thanks again for your help!

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)