Skip to content

Instantly share code, notes, and snippets.

@oknoorap
Last active August 30, 2017 04:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oknoorap/d8965e1c5847fd9c54af6e896a908afe to your computer and use it in GitHub Desktop.
Save oknoorap/d8965e1c5847fd9c54af6e896a908afe to your computer and use it in GitHub Desktop.
WordPress 4.8.1 Unknown SSL protocol error in connection to api.helpscout.net:443
$customer = array(
  'type' => 'customer',
  'email' => $customer_email
);

$fields = array(
	'mailbox' => array( 'id' => $mailbox_id ),
	'customer' => $customer,
	'subject' => $subject,
	'threads' => array(
		array(
		  'type' => 'customer',
		  'createdBy' => $customer,
		  'body' => $message,
		  'attachments' => $attachments
		)
	),
);

$fields = wp_json_encode( $fields );

wp_safe_remote_post( $this->api_url( 'conversations' ), array(
	'method' => 'POST',
	'timeout' => 45,
	'redirection' => 5,
	'blocking' => true,
	'sslverify' => false,
	'cookies' => array(),
	'headers' => array(
		'Accept' => 'application/json',
		'Content-Type' => 'application/json',
		'Content-Length' => strlen( $fields ),
		'Authorization' => 'Basic ' . base64_encode( $this->api_key . ':' . 'X' ),
	),
	'body' => $fields,
) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment