cURL throws invalid_json
-
Hi,
I wrote the following function in my functions.php:
add_action( 'wpcf7_before_send_mail', function( $contact_form, &$abort, $submission ) { // Getting user input through the your-email field $your_email = $submission->get_posted_data( 'email-newsletter' ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://mywebsite.com/MAIL=' . $your_email); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); $abort = true; }, 10, 3 );
When I submit the form, the following error displays in the console:
{code: 'invalid_json', message: 'The response is not a valid JSON response.'}
And the submission message doesn’t display (the sending icon keeps turning).
Should I add something else?
Regards,
Clara.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘cURL throws invalid_json’ is closed to new replies.