tecumseh
Forum Replies Created
-
Forum: Plugins
In reply to: [Contact form 7 TO API] JSON Not escapedThank god I thought I was going mad Here’s my topic
Forum: Plugins
In reply to: [Contact form 7 TO API] Line breaks break APISo I reinstalled everything to get rid of my changes and switched to using a more normal template.
I can confirm that multiple line breaks in the message means the message do not get sent by the API.
Also,
A message containing this: “” Did I just break you? “”
would lead the API to send: “message”: “\”\” Did I just break you? \”\” ”
CF7 does clean up the message before emailing it, is it not possible to retrieve the submission after it’s been formatted?
Forum: Plugins
In reply to: [Contact form 7 TO API] Line breaks break APISorry about the delay, I’ve been ill for a while.
As you can imagine I’d like to avoid handing out access to my server unless absolutely necessary, sorry.
Can you confirm that the following use cases work in your own environment?
1 – Adding new lines to your message in the form, does the API sanitize these?
2 – Single quotes/double quotation marks – a combination of these tends to cause issues if within the message body.(I just want to know if it’s my slightly weird JSON template causing issues :/ )
I added something like this to the string in the parse_json function to fix line breaks
trim( preg_replace( '/(\r\n)|\n|\r/', '\\n', $string))Which worked and allowed large datasets to be sent & fixed line breaks.
Forum: Plugins
In reply to: [Contact form 7 TO API] Line breaks break API{"body": {"name":"[your-name]", "email":"[your-email]", "subject":"[your-subject]", "your-message":"[your-message]"}}I know the fields are already contained within the body, but my api expects.
}, "body": { "body": {Removing the additional “body” from the JSON template I am using also causes the issue to persist.
In my attempts to fix it, I did attempt using nl2br, that allowed the POST to be sent to my api but was invalid JSON.