• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CF2021 uses CFHTTP to pass parameters to the LINE group via IFTTT

New Here ,
Feb 01, 2023 Feb 01, 2023

Copy link to clipboard

Copied

Hi ! Dear experts

I wrote a simple program to send LINE notifications to customer groups via IFTTT.

Just pass three simple URL parameters, which are as follows:

 

<CFHTTP Url=https://maker.ifttt.com/trigger/mic0121_line/with/key/boYiM....   Method="get" Charset="utf-8" ResolveUrl="Yes">

  <CFHTTPPARAM Type=“url” Name=“value1” Value='test_url_01'>

  <CFHTTPPARAM Type="url" Name="value2" Value='測試參數 2' >

  <CFHTTPPARAM Type="url" Name="value3" Value='測試參數3' >

</CFHTTP>

 

mic0121_line is the LINE customer group code defined in IFTTT, value1, value2, value3 are 3 URL parameters, some of which are Chinese Traditional characters (big5 code).

 

These codes are OK on the CF2021 Update5 test on ColdFusion Fiddle.

But why can't I send it properly when executed on my installed CF2021 Update5 computer.

 

Are there any settings that need to be changed in CF2021 Adminstrator?

TOPICS
Advanced techniques

Views

647

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 10, 2023 Feb 10, 2023

Copy link to clipboard

Copied

Open /cfusion/bin/jvm.config in a text editor. Ensure that java.args contains the following flag:

 

-Dfile.encoding=UTF-8

 

If you add the flag, you will have to restart ColdFusion.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 11, 2023 Feb 11, 2023

Copy link to clipboard

Copied

Thank you for your reply !

I followed your suggestion to set up and restart and still can't send LINE notifications. But executing on my another CF2016 computer and ColdFusion Fiddle CF2021 Update5 are OK.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 12, 2023 Feb 12, 2023

Copy link to clipboard

Copied

Oh, I have just seen something odd. The code sample you posted above has curly quotes:

“url” Name=“value1”

Replace them with normal double quotes or with single quotes:

"url" Name="value1"
'url' Name='value1'

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 17, 2023 Feb 17, 2023

Copy link to clipboard

Copied

Thank you for your new reply, I tried single quotes and double quotes, or mixed quotes and the result is the same, it works correctly in CF2016 and ColdFusion Fiddle CF2021 Update5, but not from my own CF2021 Update5 computer to send LINE notifications.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 18, 2023 Feb 18, 2023

Copy link to clipboard

Copied

There's something else. Replace

Url=https://maker.ifttt.com/trigger/mic0121_line/with/key/boYiM

with

Url="https://maker.ifttt.com/trigger/mic0121_line/with/key/boYiM"

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 18, 2023 Feb 18, 2023

Copy link to clipboard

Copied

Copy the following code and test with it.

<CFHTTP Url="https://maker.ifttt.com/trigger/mic0121_line/with/key/boYiM" Method="get" Charset="utf-8" ResolveUrl="Yes">
  <CFHTTPPARAM Type="url" Name="value1" Value='test_url_01'>
  <CFHTTPPARAM Type="url" Name="value2" Value='測試參數 2' >
  <CFHTTPPARAM Type="url" Name="value3" Value='測試參數3' >
</CFHTTP>
<cfdump var="#cfhttp#" >

What happens when you do?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 17, 2023 Feb 17, 2023

Copy link to clipboard

Copied

Help us help you: what's the error or result you're getting?

 

You've said only that you "can't send it properly".  What tells you that? What's in the cfhttp.filecontent, or indeed in a dump of the cfhttp scope? 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 18, 2023 Feb 18, 2023

Copy link to clipboard

Copied

Thank you for your help, output cfhttp variable observation filecontent as shown in the figure, there is a "Connection Failure" error; But on Fiddle execution was successful, and appears "Congratulations ! You've fired the mic0121_line event"。

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 18, 2023 Feb 18, 2023

Copy link to clipboard

Copied

Ok, thanks for that. And based on it, I'd say that a likely difference between your machine and the cfiddle is that you may not have updated that Java that underlies your cf. For more on how that's a common cause of such cfhttp failures, as well as how to go about resolving the matter (updating the Java cf uses), see my blog post on the cf portal:

 

https://coldfusion.adobe.com/2019/06/error-calling-cf-via-https-solved-updating-jvm/

 

And as for how to detect the version of Java you're running, I have a post on that as well:

 

https://www.carehart.org/blog/2021/4/5/Confirming-ColdFusions-Java-version-via-CFML-code

 

And if you have trouble afrtet updating the jvm, I have a post on that as well:

 

https://www.carehart.org/blog/2014/12/11/help_I_updated_CFs_JVM_and_it_wont_start

 

Let us know how things go. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 18, 2023 Feb 18, 2023

Copy link to clipboard

Copied

LATEST

Thank you very much ! I'll try it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation