Questions tagged [wp-remote-post]
The wp-remote-post tag has no usage guidance.
60
questions
0
votes
1
answer
42
views
How can I run a second wp_remote_post() based on the response of the first?
I'm using wp_remote_post() to integrate with an API that requires me to send one request after another to a REST API. (The first to create a user record, the second to add a tag to it).
Using Guzzle I ...
0
votes
2
answers
28
views
Send post to remote wp site from post edit window with all data excerpt image
I have to wp site ex1.com and ex2.com, at ex1.com i have created a post and i want to send it to ex2.com with Title, content, custom fields, tags, category with a form submit button at edit window. I ...
0
votes
0
answers
20
views
register_rest_route, Compare purchase codes and send a response
I have a question, I would be grateful if someone could help me
I am working on WordPress plugins, I have 2 files, the first file is Verification which is for users and the second file is the ...
0
votes
1
answer
159
views
WP_Error Object in wp_remote_post & wp_remote_get
I am using localhost and working on a wordpress plugin, I try to get and post data with wp_remote_get and wp_remote_post,i installed lmfwc and i create a rest-api-key, as you can see i used consumer ...
0
votes
0
answers
24
views
wp_remote_post to admin-ajax.php isn't sending body value
I'm trying to get my code to get the TMDB API data but since the API response contains multiple pages, I'm trying to recursive call my function and increment the page number each time. I'm logging to ...
0
votes
2
answers
25
views
Convert HTTP_Request2 to wp_remote_post
I have some php in WordPress using HTTP_Request2 that I'm struggling to convert to use wp_remote_post.
This code currently works:
$xmlCustomerDataByAuthorLicenseID = '
<GetCustomerDataByAuthor&...
0
votes
2
answers
911
views
upload image with rest API to the media library
I am working on uploading an image to the media library and then attaching it to the featured image. I put the code below in my functions.php file and submitted a JSON file through postman, but for ...
0
votes
0
answers
168
views
wp_remote_post vs curl to send data in Wordpress plugin
I have this curl code and is working as intended. This code contacts my server:
$curl = curl_init();
$post_data = array();
$post_data[] = "plugin: $plugin";
$post_data[] = &...
-1
votes
1
answer
249
views
wp_remote_post() and Pem certificates
Is it posible to aunthetificate with wp_remote_post() sending the pem, key and password for the certificate.
I tried
$url = 'https://xxxx.yyyyy.zzzzz';
$body='{"transactionParameters":{"...
1
vote
1
answer
350
views
Webhook: save_post action fires wp_remote_post twice
I am trying to implement a webhook in a plugin which should fire everytime a user saves a post. It works fine, but I recive two requests on frontend api. The first request has got a wrong slug. I ...
2
votes
1
answer
1k
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 ...
1
vote
0
answers
731
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
508
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
243
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
350
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
1k
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
321
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
2k
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
1k
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
851
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
626
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
510
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
1k
views
Publish page remotely
Is it possible to publish a page to WordPress remotely?
Example diagram:
0
votes
1
answer
291
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
6k
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
577
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
885
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
2
answers
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
1k
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
333
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
637
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
7k
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
810
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
1k
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 ...
3
votes
2
answers
22k
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 ...
5
votes
1
answer
11k
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
288
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
5k
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
314
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
10k
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 ...
5
votes
3
answers
5k
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
1k
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
981
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
802
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 ...
26
votes
1
answer
40k
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
5k
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
11k
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
...
8
votes
1
answer
15k
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 = ...