Articles of wp remote get

On Plugin Activation, How Do I Check for Proper Transport Mechanism?

For a plugin that communicates with somewhere else, I hear we’re supposed to use wp_remote_post and wp_remote_get instead of PHP’s Curl library. Okay, but is there a fast and proper way on plugin execution to test for a blog’s PHP/host OS to have the proper transport mechanism installed? I mean, I could attempt a test […]

How to Download and install plugin database remotely

I have the following problem. I got a plugin that is huge due to all the data needed. The data is all the countries and cities in the world and also a maxmind.mmdb database. 1 – Issue Currently I got everything packed in the plugin which makes a 20mb plugin and that creates a problem […]

wp_remote_get vs. fetch_feed ? which is the better for performance?

I m trying to share my web site contents for other web sites using by external loop file or rss file. when i asked some questions about wp_remote_get function ; @Serkan suggest to me , using fecth_feed methot / function etc. (check the question here.)= I really confused , which one i should, which one […]

wp_remote_get returns an error for valid URL

I currently have the following snippet of php to fetch some HTML and render it in my theme(squash theme). <?php $response = wp_remote_get( ‘http://www.toucan-it.co.uk/wp-content/themes/squash/index5.html’ ); print $response [‘body’]; ?> The file I’m trying to request is available at the following URL. http://www.toucan-it.co.uk/wp-content/themes/squash/index5.html Problem The problem is when trying to retrieve ‘index5.html’ via the web browser […]

wp_remote_get() not retrieving pages properly

I am using wp_remote_get() to retrieve different pages from the web. It is a news site. Most of the time, this works successfully. However, sometimes, the request returns success (code 200), but the content of the page is differet from the page that is retrieved by a brwoser (the content of the page returned with […]

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(), […]

wp_remote_get vs. file_get_contents vs. cURL?

I need to fetch the contents of a remote file. Which is better for performance – wp_remote_get, file_get_contents, or cURL? How exactly does wp_remote_get work? Can you suppress errors, ex. @wp_remote_get ? Thanks

rewrite script to use wp_remote_get instead of file_get_contents_curl

I have a script that pulls the facebook likes via facebook graph and writes them in my DB. However it uses file_get_contents_curl for the request and this is causing problems, so I’d like to use the wp_remote_get() command. I’ve tried to change it but somehow I can’t do it (I don’t really have PHP knowledge). […]

How to consume and display external data in WordPress from another website

I am trying to access data from another website to display on a WordPress Website I am developing. So far I have the following: <?php /* Template Name: Testing remote data */ get_header(); <div class=”main”> <div class=”col-sm-12″> <header> <h2>Testing remote data</h2> </header> </div> <div class=”container”> <div id=”content” role=”main”> <div class=”col-sm-12″> <?php $url = ‘http://www.bbc.co.uk/news/’;// this […]

HTTP request on localhost failing

I have a WordPress instance on my development box with the WP REST API plugin installed. I am attempting to create my own plugin to use wp_remote_get() to communicate with my own custom PHP application on the same box. I have set up my hosts file with the name of the custom PHP application. I […]