When i go to wordfence diagnostics ,in the connectivity part i have some errors.
Can you please help on this?
Kindly see the image atached
Regards
Nuno
]]>add_action('wpcf7_before_send_mail','blog_cf7_api_sender' );
function blog_cf7_api_sender( $contact_form ) {
$form_id = ( $contact_form )->id();
if ( $form_id == '02d6ca7') {
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
$posted_data = $submission->get_posted_data();
$name = $posted_data['client-name'];
$phone = $posted_data['client-phone']; $stream_code = [4yv1];
$token = [12345];
$url = 'https://coolapi.com';
$args = array(
'body' => json_encode(array(
'name' => $name,
'phone' => $phone,
'stream_code' => $stream_code,
'token' => $token,
)
'headers' => array(
'Authorization' => 'Bearer $token', 'Content-Type' => 'application/json',
)
);
$response = wp_remote_post( $url, $args );
}
}
}
I have created a custom plugin within WordPress to POST contact form 7 data to an external API when a client submits their info, I followed a tutorial on YouTube step by step, but nothing is being posted to the API URL. I am not sure if it’s because the coding for contact form 7 is outdated now or if I am possibly using wp_remote_post incorrectly.
]]>The systems worked flawlessly for over a year but after the last update, both plugin and api, I am getting a CSRF token mismatch error (419) when calling the api using wp_remote_post.
I am able to call the api from other clients , like Postman, but not through wordpress’ built in remote post method
]]>Recently we have changed hosting provider and migrated site. But after migration, Wordfence Scan is not working and we see below issue in diagnostic tab.
HTTP/1.1 400 Bad Request
Connection: close
x-powered-by: PHP/7.4.11
content-type: text/html; charset=UTF-8
x-robots-tag: noindex
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
referrer-policy: strict-origin-when-cross-origin
x-litespeed-tag: 2ff_HTTP.400
expires: Wed, 11 Jan 1984 05:00:00 GMT
cache-control: no-cache, must-revalidate, max-age=0
x-litespeed-cache-control: no-cache
content-length: 5
content-encoding: br
vary: Accept-Encoding
date: Fri, 03 Sep 2021 05:32:14 GMT
server: LiteSpeed
content-security-policy: upgrade-insecure-requests
alt-svc: h3=":443"; ma=2592000, h3-29=":443"; ma=2592000, h3-Q050=":443"; ma=2592000, h3-Q046=":443"; ma=2592000, h3-Q043=":443"; ma=2592000, quic=":443"; ma=2592000; v="43,46"
Please note that no issue with ajax files etc.
Any assistance is appreciated.
I am receiving an error when I am trying to scan. Ongoing to the diagnostics tab, I found this error.
p_remote_post() test back to this server failed! Response was: 500 Internal Server Error
This additional info may help you diagnose the issue. The response headers we received were:
I don’t know if it’s okay to share the log on public forum. How can I share the logs with you?
Or do you have any idea why this is happening?
Your help will be most appreciated.
Thank you.
]]>{"message": "Cannot send an empty message", "code": 50006}
Actually, this is not a problem with Discord because my curl request works fine.
Here’s my curl request snippet.
function discordmsg($site, $errorcode, $desc, $webhook, $name){
$msg = json_decode('{ "content": "Monitoring update, read more in the embed below! If you believe a false alarm has been triggered or something has gone wrong, email us ", "embeds": [ { "title": "Uptime Alert", "description": "Your site '.$site.' ('.$name.') is down, Expected response 200/302, Got response '.$errorcode.' (Which means '.$desc.')",
"color": 16711680, "footer": { "text": "This was given by the automatic monitoring system provided by example" } } ], "username": "Monitoring Update",
"avatar_url": "https://example.com/monitoring/monitoring.png" } ', true);
if($webhook != "") {
$ch = curl_init($webhook);
$msg = "payload_json=" . urlencode(json_encode($msg))."";
if(isset($ch)) {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $msg);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
}
}
Please tell me how this can be changed into wp_remote_post()
]]>Is it possible to insert custom post types with wp_remote_post?
I’m developing a simple plugin that will insert different posts from one site to another. It works like a charm with the default post type. But I can’t get it to work with any other post type.
I read some documentation and thought I could give the post type in de the body array (‘post_type’ => ‘page’), but whatever I do it’s always imported as a default ‘post’.
]]>Server environment
Remote post: wp_remote_post() failed. Contact your hosting provider. 429
I checked that this error exists on a clean WordPress + Woo v4.0.1 with the standard template without any plugins. I use VPS and have a localhost on PC (But this have too 429)
The VPS support service checked the server on issues and found no any problems, and also reported that the cUrl was working well. They asked to contact you (developers) to clarify what needs to be configured and they will configure the server according to the requirement from you.
Please what need ON on server for this work. Thanks
PS. Please Add Option for Disable Admin Dashboard (I use another plugin + Google SEO)
Connecting back to this site
wp_remote_post() test back to this server failed! Response was: cURL error 35: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
I stumbled across it looking for a reason for why ALL traffic is appearing to come through out host (Siteground) rather than the user’s actual IP. My own IP comes up as Siteground as well, which is obviously incorrect. Any help? I’m out of ideas.
]]>