Articles of wp remote request

wp_remote instead of file_get_contents on non json

I have searched this website and although there are a lot of threads regarding the wp_remote functions but none are what I am asking and would like to know if its possible. I am wanting to scrape a website and get a specific div#id and grab its elements within that section. I can do this […]

http_response_timeout filter not working

I am writing a WordPress plugin that makes calls to external sites. I want to raise the timeout for all wp_remote_* calls, so I added the following to the __construct function of my plugin: add_filter(“http_response_timeout”, function($timeout) { return 30; }); But the calls still time out after 5 seconds. I also tried using a separate […]

How can I call specific function if requested URL is not found?

My website is fully API based and builds pages/posts from API data. I was thinking to create something like PHP magic function __call to call specific function when requested URL would return 404, but do it before it happens, so I could send API request and create the page on the fly and return the […]

wp cron job fires at every second or so, if callback is wrapped with DOING_CRON check it never fires at all

I am a bit lost while dealing with a open source plugin implementing wp cron. You can read about the problem on github https://github.com/nekojira/wp-currencies/issues/6#issuecomment-116735909 – I will summarise it also here. Unfortunately there’s a bit of code involved to paste it on Stack. I have a method in one class, which makes a remote request […]

Proxy not working with Requests::request_multiple()?

I try to send async multiple requests with proxy option by built-in WP Class Requests, but it’s not working. $options = array( ‘proxy’ => $proxy ); Single Request, it’s working, so the proxy itself is working properly. $s = Requests::request($link1, array(), array(), ‘GET’, $options); The result of var_dump($s): object(Requests_Response)[1637] public ‘body’ => string ‘<!doctype html><html […]

how to remotely check a username / password from within a plugin

people need a user account on my site to be able to download a plugin. I want to add an activation function in the plugin so a user must supply their username and password the first time they use the plugin to make sure that they have a valid user account on my site before […]

How to run a function on plugin's options page?

I am writing a plugin that syncs data from a third party service to custom post types in wordpress via HTTP/SOAP. There will be the option to run it on an interval (using wP_cron functions) but I also want to include a ‘Sync’ button to be able to manually pull in or update data without […]

Using wp-cron in backpress – problems with wp_remote_post, fsockopen error

I’m working on a BackPress project where I need to schedule cron tasks. The cron_uri for BP is stored in options, rather than hardcoded as it is in WP core. I’ve tried setting the option to mysite.com/wp-cron.php (where wp-cron.php is essentially a copy of the same file from WordPress, modified to include only the relevant […]

Facebook OAuth, WP_Http::request() vs wp_remote_request()

Running WordPress 3.3.2 and PHP Version 5.2.17 I’m trying to get the access_token from Facebook using wp_remote_request() and Facebook OAuth API (btw, working example at the end of this entry). Is there any reason why this doesn’t work (should according to doc and source code)?: $response = wp_remote_request(‘https://graph.facebook.com/oauth/access_token’, array( ‘timeout’ => 60, ‘sslverify’ => false, […]

WP_Http_Cookie destroys cookie value through urldecode()

Background: Working on a Widget that uses a remote API using wp_remote_post to log into the service, once logged in storing the cookies received for the second request to query data with wp_remote_get. Problem: The cookies from the first request are stored in the response as WP_Http_Cookie objects and their values are run through urldecode […]