Questions tagged [wp-remote-post]
The wp-remote-post tag has no usage guidance.
50
questions
1
vote
1
answer
59
views
Wordpress wp_remote_post vs wp_remote_request
I'm somehow new to Wordpress and its API and while writing an simple Rest Service to an remote Server i have been asked to use the native wp_remote_X functions.
Right now i have some trouble to ...
0
votes
0
answers
165
views
Post content in wp_remote_post
I'm trying to post content with wp_remote_post. Content that I want to be posted is in a separate php file, which echo's block with html and WPBakery shortcode.
I tried include but it didn't work, I ...
0
votes
0
answers
106
views
Limit the number of external API calls per second
I would like to use wp_remote_post to retrieve data from an external API. The matter is that the external API only accepts a maximum of 5 requests per second. However, depending on how many users are ...
0
votes
1
answer
78
views
How to code auto-retry for API call
On my site I have a form that can be filled out by users. Once submitted, I am storing the form data in a third-party service using their RESTful API.
function gravity_forms_1_after_submission( $entry,...
0
votes
1
answer
164
views
wp_remote_post empty $_POST
Ok, I've searched a lot but cannot understand what I'm missing.
I need to post some data to a php file on another server,
but if I print the wp_remote_post variable I get:
{"headers":{},&...
0
votes
0
answers
632
views
Problems getting values from response from wp_remote_post
I am using wp_remote_post to send a request to a 3rd parti API. The response from the API looks something like:
{
status: 'a',
member_id: 12345678
}
I understand that this is returned in the body ...
0
votes
0
answers
153
views
Cron and request with wp_remote_post
I have a problem with a plugin I'm working on, I have implemented a cron that 2 times a day makes a call to update the data, the call is made with the wp_remote_post function.
$response = ...
1
vote
1
answer
852
views
Post body not working with wp_remote_post()
I'm trying to post with with the following code
$userTokenApi = 'https://api.mindbodyonline.com/public/v6/usertoken/issue';
$args = array(
'headers' => array(
'Content-...
0
votes
1
answer
815
views
wp_remote_post not working with admin-post.php
I am developing a plugin that has a long-running function for setting up a load of posts of a custom post type. I want to run this function asynchronously. In order to do this, I have tried something ...
1
vote
0
answers
499
views
cURL RETURNTRANSFER function in wp_remote_post
I have this cURL code below which is running on PHP, yet when I did it with WordPress it didn't work. I tried using WP_REMOTE_POST I couldn't do the return transfer function of cURL, what can be a ...
3
votes
0
answers
376
views
Does wp_remote_post support asynchronous request?
I want to post to multiple rest API endpoints with wp_remote_post but don't want to wait for the response back and keep continuing code execution. Some popular clients like guzzle etc. support ...
0
votes
1
answer
148
views
Inconsistencies between wp_remote_post and cURL
I can successfully make the RESTful post using cURL:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.mindbodyonline.com/public/v6/usertoken/issue');
curl_setopt($ch, ...
0
votes
1
answer
519
views
Publish page remotely
Is it possible to publish a page to WordPress remotely?
Example diagram:
0
votes
1
answer
103
views
wp_remote_post code conversion
I'm trying to convert this php code to the wordpress wp_remote_post() format.
Thoughts, Ideas, This is NOT my forte, lol.
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$...
0
votes
2
answers
3k
views
How to send the body in wp_remote_post as "raw"?
I'm not sure if I'm asking the right question, so here is the context.
I'm making a POST to an API (The api is to a Google Sheets Script - so there are some unusual limitations). When I use postman ...
1
vote
1
answer
423
views
How to create custom post by using REST API securely?
I am new to this. Figuring out how to use it. I am trying to create a custom post by filling out a frontend form. I am using ajax button in the form. This button triggers wp_remote_post().I have the ...
1
vote
0
answers
614
views
Sending post request with wp_remote_post not working correctly
I need to submit a form on the woo-commerce product page via restful API custom endpoint
the problem is the wp_remote_post not working correctly with me or me mostly I did something wrong.
The form ...
1
vote
1
answer
2k
views
How to convert this cURL to wp_remote_*?
My function below includes a cURL call which throws a text string at a Google Cloud text analysis API, returning a response object, which we then parse to get a specific piece.
It has been ...
0
votes
0
answers
808
views
Send POST request to Flask app from functions.php file
I have an endpoint on my Flask app that I can hit via Postman and it works fine. However, when I write the POST request in my functions.php file and trigger it via button press, my server returns a ...
0
votes
1
answer
247
views
Generate new post from email
I have a wordpress site that allows users to set their location when they are logged in, and then uses the heartbeat API to their door display.
However, I have had to build in the role of managers ...
0
votes
0
answers
480
views
wp_remote_post To external API multiple values with the same key
I am trying to create a WP plugin that calls an external API using HTTP POST. I am using wp_remote_post and my arguments look like this:
$body = array(
'CustomerID' => '10',
'Items' => [...
0
votes
2
answers
5k
views
How to send a HTTP Post request using PHP Curl and Wordpress
I am working on a script to bring in an xml file from another server via Post request, This would then return another xml of data which I can then store into a wordpress database depending on certain ...
2
votes
1
answer
631
views
API getting null values with wp_remote_post
I'm trying to post some data to an API and I keep getting null values in the fields.
My PHP code:
$url = 'https://apiconnector.com/v2/address-books/136517/contacts';
$username = 'apiuser';
$...
1
vote
0
answers
807
views
wp_remote_request header error even though working properly with cURL
I'm trying to make calls to a JSON API inside my wordpress theme.
I tried with the cURL option, making a custom function and things works as it should but I wanted to use the built-in wordpress ...
2
votes
1
answer
14k
views
Stuck with wp_remote_post sending data to an external api on user registration
I am trying to create a basic plugin to send user details to a CRM when a user signs up on the WordPress website as a basic subscriber.
I have reached a sticking point, I have tried to interpret the ...
4
votes
1
answer
8k
views
Wp_remote_post not posting data
This works in php:
$postdata = http_build_query(
array(
'api' => get_option('API_key'),
'gw' => '1'
)
);
$opts = array('http' =>
...
1
vote
0
answers
230
views
wp_remote_post - handling responses
I need to add a form to my WordPress site that will post its data to an external API without ever storing the form data in the mysql database. I also need to show components of the response from the ...
2
votes
1
answer
4k
views
wp_remote_post doesn't work with more than 1024 bytes in the body
What I need
I'm working with a third-party API (for the intents of this question, it's irrelevant which one) and need to send a POST request to an external service.
I'm trying to use wp_remote_post ...
0
votes
1
answer
287
views
wp_remote_post rabobank omnikassa (version2) - error 5001
i am actually not sure if this should be a wordpress question/issue or should be asked elsewhere (but one thing might cause the other..)
in any event, trying to write a custom rabobank omnikassa ...
4
votes
3
answers
9k
views
Send data to 3rd party api with wp_remote_post on wp_login
Is it possible to use wp_remote_post to send http post requests to 3rd party api's? I wasn't able to successfully save the user object as a javascript variable, so I was hoping I could make an http ...
4
votes
3
answers
4k
views
Difference between wp_remote_post and wp_safe_remote_post
The documentation for wp_remote_post says
In many cases you may be better served with wp_safe_remote_post
Looking at the source code, the only line that's different between the two is that ...
4
votes
3
answers
989
views
Log in from one wordpress website to another wordpress website
My client explicitly does not want to use 'multisite' wordpress option.
My client has a main site and 199 sub sites (other domains).
A user has usermeta with meta key: branch_id
As an example (...
2
votes
1
answer
780
views
How to set charset for wp_remote_post request?
I'm using wp_remote_post() on a project and it works great. But seems like the server on which I need to make the POST request is a Windows (ISS) server. So the third-party service that provides this ...
1
vote
1
answer
3k
views
How to send file by wp_remote_post?
I don't want cURL in my WordPress plugin
Hi, cURL is not safe to use on WordPress site. And sometime, cURL has been disable on customer hosting.
And i decided to use wp_remote_post to send file for ...
0
votes
0
answers
786
views
Does wp_remote_post() require curl?
Does the following code require curl?
$response = wp_remote_post( $url, [ 'body' => json_encode( $data ) ] );
0
votes
2
answers
2k
views
wp_remote_post and form post
Actually it is more general question but now i am trying to use it on wordpress site so I preferred to post it here.
I am trying to understand the difference between remote post and form post.
When ...
22
votes
1
answer
33k
views
Sending JSON string through wp_remote_post()
I'm building a mailchimp integration and they require a POST call with JSON code.
No, I'm using this code that actually works:
$data = wp_remote_post($url, array(
'headers' => array('...
1
vote
2
answers
4k
views
creating form for wp_remote_post
i'm using code from the wordpress codex: (this is the generic version, my code is working though)
$response = wp_remote_post( $url, array(
'method' => 'POST',
'timeout' => 45,
'...
2
votes
1
answer
10k
views
Change the headers content type with wp_remote_post
Working with the remote API requests with WordPress. I have used wp_remote_post() function to request the HTTP data but I am unable to update the headers Content-type I am using the following code
...
6
votes
1
answer
12k
views
How to add Request header in WordPress remote api calls
Hey am new to WP development, can any one tell me how to add request headers in wp_remote_get() or wp_remote_post() remote api calls.
I tried the following but didnt work
$response = ...
3
votes
1
answer
5k
views
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 ...
0
votes
1
answer
229
views
Post to a server writen in Hapijs from wordpress using wp_remote_post
I'm trying to post to a server written in Hapijs from wordpress using wp_remote_post.
I'm getting connection refused and I can't figure out what is wrong.
The server is on port 8080.
Nb:...
4
votes
1
answer
5k
views
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 ...
4
votes
2
answers
13k
views
Error timed out with succesfull wp_remote_post
What I'm trying to do: Passing POST data by using wp_remote_post.
foreach ( $articles as $article_id ) {
$postarray = array(
'method' => 'POST',
'timeout' => 5,
'...
0
votes
0
answers
4k
views
WordPress wp_remote_post() sending informaiton to Redmine REST API
I am having a problem using WordPress's wp_remote_post() function with Redmine's REST API.
The main issue is that when I attempt to post, i get a 403 - forbidden return.
This is the code that i'm ...
0
votes
1
answer
522
views
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:
...
0
votes
0
answers
86
views
saving file to external server vip
I have a handwritten script that writes a text file locally in one of my Wordpress pages, but now I need it to read and write to a remote server that is password protected and accessible only through ...
2
votes
1
answer
1k
views
Retrieving Google Plus share count with wp_remote_post
So I've spent most of my morning working on my website's customized social share buttons. Reading out Twitter and Facebook shares were no problem, but Google Plus is a real challenge, as they don't ...
1
vote
1
answer
876
views
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 ...
2
votes
1
answer
3k
views
Remote login with only the username not working
I'm writing a module for remote login into another WP site via my plugin's admin. This is the code I'm using on the sender side:
<?php
add_action('init', 'connect');
function connect()
{
//I ...