Calling an API to do authentication / user login

It’s better not to do so. And I’m completely against overriding the default authentication mechanism simply because of WordPress and it’s plugins usually are depended on the website’s database. But if you’re really into this situation WordPress provides a filter called authenticate: add_filter( ‘authenticate’, ‘wpse75679_auth’, 30, 3 ); function wpse75679_auth( $user, $username, $password ) { … Read more

wp_remote_get() returns 403 while file_get_contents() does not

Why do you have curly brackets in there? Maybe sanitize/process the query string with htmlspecialchars() first. The error is complaining about non-standard characters…which is what your curly brackets are doing. Build the query string with the $ip value, convert with htmlspecialchars(), then add the URL to the query string. Pass that variable to the wp_remote_get() … Read more