Delete post by giving its link

I found the solution to my problem:

wp_delete_post(url_to_postid("url"));

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