Articles of http

Can I use HTTP POSTs? Is there a better alternative?

I am use to php development in general and I am use to getting a lot done by making a POST to a php file. However I have not seen people using $_POST in WordPress. I have seen one discussion about someone wanting to create new posts on their blog using $_POST, and they were […]

Programmatically log in a wordpress user

I am trying to programmatically log in a wordpress user, using the following function for that. public function auto_login( $user ) { $username = $user; if ( !is_user_logged_in() ) { $user = get_user_by( ‘login’, $username ); wp_set_current_user( $user->ID, $user->user_login ); wp_set_auth_cookie( $user->ID ); do_action( ‘wp_login’, $user->user_login ); } } Unfortunately it seems not to be […]

Divert http to https with WordPress on IIS

I have a WordPress site running on IIS. The site has an associated SSL Certificate. Right now I am able to access the site with http and https. How can I get my http to redirect to https? Any help would be greatly appreciated. Thank You

Clarity needed on usage of multiple 403 forbidden header() functions at the beginning of the plugin files

Just see the following code snippet. I have came across this in one of the plugins that I am reading now. if ( ! defined( ‘ABSPATH’ ) ) { header( ‘Status: 403 Forbidden’ ); header( ‘HTTP/1.1 403 Forbidden’ ); exit; } I understand that this script is sending an forbidden 403 header response to the […]

Access general settings trough wordpress files

I was reading an article about HTTPS and that you could turn on SSL and HTTPS for WordPress quite easily. However in the article it said that you should go to Settings > General Settings within the admin panel and change WordPress Address (URL) and Site Address (URL) from http:// to https://. However after doing […]

Handling the response sent from a ruby on rails application in wordpress

I am using my rails application to send data to a wordpress site. Basically if a user has wrong password, I am going to end the reverse proxy and redirect the user back to the wordpress site but I want to pass data along. In Rails, I use Net::HTTP to send data to another server: […]

How to get title tag of an external page with http api?

What is the best method to retrieve the title tag of an external page using the http api? The snippet below will get the body but I can’t find the right documentation about how to just get the tag. :/ $url = ‘http://wordpres.org’; $response = wp_remote_get( $url ); if( is_wp_error( $response ) ) { echo […]

Get the final destination after WP_Http redirects (WordPress)

I’m doing some requests to an API via WordPress, and the API uses SSL connections if they’re turned on in the API settings. I’d like to determine whether SSL is turned on or off without having to ask the user if SSL is turned on on their account, and the API does a good job […]

Why Better WP security plugin returns 418 I'm a Teapot “error”?

I am working on the WordPress website and all of a sudden after deploying it on the server, I started seeing a problem where some of the pages on my website return 418 I’m a Teapot as Response status and error as content. After going through a few posts on HTCPC Protocol and blogs on […]

How can I use CURLOPT_USERPWD in wp_remote_post?

I’m trying to setup a proper cURL call in WordPress so am using wp_remote_post(). However, I’m having trouble authenticating the user via wp_remote_post(). Any idea how to convert the following to be used in wp_remote_post? curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_USERPWD, “$username:$password”); Full example of proper cURL basic auth is here.