using wp_remote_get to retrieve own url on local host

I have a website in local development at test:8888 and I am trying to get the following to work in my functions.php file. $response = wp_remote_get( ‘test:8888/?p=1’ ); print_r($response); Unfortunately this is printing WP_Error Object ( [errors] => Array ( [http_request_failed] => Array ( [0] => A valid URL was not provided. ) ) [error_data] … Read more

WP_Remote_Get Not working

I have a plugin which uses wp_remote_get() and it’s not working on my nginx server so I decided to test this. I created a file called test.php and inserted: <?php $response = wp_remote_get( ‘http://www.domain.com/mytest.php’ ); print $response [‘body’]; ?> When I run this file I am getting error: 2017/02/04 16:22:31 [error] 16573#16573: *461100 FastCGI sent … Read more

Trying to get an api request getting error 404

I’m trying to get a list of locations from a website called weedmaps. This is the code that I’m using: function call_for_api() { $url=”https://api-v2.weedmaps.com/api/v2/listings”; $response = wp_remote_post( $url, array( ‘timeout’ => 45, ‘redirection’ => 5, ‘httpversion’ => ‘1.0’, ‘blocking’ => true, ‘headers’ => array(‘accept’=>’application/json’,’accept-encoding’ => ‘gzip, deflate, br’,’connection’ =>’keep-alive’), ‘body’ => null, ‘cookies’ => array(), … Read more

What’s a simple but secure method to get file contents into WordPress?

The scenario I’m developing a plugin, and part of it requires lots of text content (help descriptions) that I would prefer to keep as separate text files (in a subdirectory within the plugin) for organisational and version control purposes. The obvious candidate would be file_get_contents(), but its usage with WordPress is generally frowned upon. I’ve … Read more

Is there any background process that I can run from plugin without depending on page hits on a website without affecting page-load speed?

I am developing a WordPress plugin and wants to run a background task that calls an API and updates database table. Now, the API can only give results for 5 DB entries in one go and for 500 entries in my table, I have to make 100 API call. The API has allowed TPS quota … Read more

How do I execute a wp_remote_get call using NTLM authentication?

I need to use ntlm authentication for a remote call, and I’m not sure how to configure the wp_remote_get call to do so. I have used wp_remote_get successfully in other situations without NTLM by passing the appropriate header: headers -> authentication -> basic u:p but I haven’t been able to find any information about using … Read more