wp_insert_post not working fine

As Joshua suggested in his comment, your code isn’t escaped properly.

Just before “See Original Article” (in both snippets) you have target="_blank" on your links with single quotes. Replace that with double quotes target="_blank"

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