ColdFusion (cf)http

hypertext-transfer-protocol
hypertext-transfer-protocol

HTTP stands for Hypertext Transfer Protocol and it was first used in the World Wide Web global information initiative in 1990.

Since then, HTTP has became a part of our every application, basically we can said and a part of our lives. Every day when we search something on the internet we use HTTP , sometimes we have to actively use HTTP to solve problem.

ColdFusion has built-in its own tags for HTTP support. As web developer you have to take advantage how to use this tag.

First we are going to see how HTTP actually works.
Simplest definition is that HTTP is way for clients to request something from a Web server, but for Web servers to provide response for clients request.If you type into your browser some adress like (e.g. //www.socialads.guru/ ) you actually telling your browser  to send HTTP request to the web server, then server process your request, get data and returning into your browser.

ColdFusion uses his tag cfhttp for http processes.

The main functionality of cfhttp is to retrieve data from another page,site or api. First of all you have to tell which url are you gona use and which method.

<cfhttp url=”Url_which_you_need” method=”get” >

In this example we are using GET method. When cfhttp returns data it’s like a structure.

In that data we have variable FileContent and this variable holds all the data returned to us by the provided URL.

 

We can dump that variable to see raw text.

Example:

Screenshot_1_ColdFusion
Screenshot_1_ColdFusion

Sometimes you may need to pass some parameters to the URL or put value of that parametars into database using method post.

ColdFusion also have built-in tag for http parametars (cfhttpparam) and they have to be written between cfhttp tag.

Example is taken from this link

<!— This example consists of two CFML pages.

The first page posts to the second. —>

<!— The first, posting page.

This page posts variables to another page and displays the body of the response from

the second page. Change the URL and port as necessary for your environment. —>

<cfhttp

method=”post”

url=”http://127.0.0.1/tests/http/cfhttpparamexample.cfm

port=”8500″

throwonerror=”Yes”>

<cfhttpparam name=”form_test” type=”FormField” value=”This is a form variable”>

<cfhttpparam name=”url_test” type=”URL” value=”This is a URL variable”>

<cfhttpparam name=”cgi_test” type=”CGI” value=”This is a CGI variable”>

<cfhttpparam name=”cookie_test” type=”Cookie” value=”This is a cookie”>

</cfhttp>

<!— Output the results returned by the posted-to page. —>

<cfoutput>

#cfhttp.fileContent#

</cfoutput>

<!— This is the cfhttpparamexample.cfm page that receives and processes the Post request. Its response body is the generated HTML output. —>

<h3>Output the passed variables</h3>

<cfoutput>

Form variable: #form.form_test#

URL variable: #URL.url_test#

Cookie variable: #Cookie.cookie_test#

CGI variable: #CGI.cgi_test#

Note that the CGI variable is URL encoded.

</cfoutput>

 

In this example we can see  that those two tags provide you a really good deal of flexibility to your application, also they can help you to manipulate over your CF scripts.

Now we can try together a short example of cfhttp.

  1. Write cfhttp tag and forward a url,method and store result into one variable.
  2. In the second step you have te parse/deseriazle JSON or XML (small tips: By using variable from cfhttp tag you can access fileContent)
  3. Write a loop and print the parsed data (It would be good to do cfdump of results before printing – see picture above)

 

If you want a little help, see below:

<cfhttp

url=”http://www.omdbapi.com/?i=tt0944947&Season=1″

method=”get”

result=”JSONdata” />

<cfset parsed = deserializeJSON(JSONdata.fileContent) />

<cfloop from=”1″ to=”#arrayLen(parsed.episodes)#” index=”i”>

<!— <cfdump var=”#parsed.episodes#”/> —>

<cfoutput><h2>Title: #parsed.episodes[i].title#</h2></cfoutput>

<cfoutput>Episode: #parsed.episodes[i].Episode#</cfoutput>

</br>

<cfoutput>Released: #parsed.episodes[i].Released# </cfoutput>

</br>

<cfoutput>imdbRating #parsed.episodes[i].imdbRating# </cfoutput>

</br>

</cfloop>

 

 

 

 

 

Kadir B | September 19, 2016

Leave a Reply

CONTACT USCONTACT US

grow your business today

Contact Name (required)

Organization Name (required)

What Are Your Interests/Needs

Web site(required)

E-mail (required)

Your Message

Our ServicesOur Services

WHAT WE CAN DO

Social Media Strategy

Our team will help you identify industry influences and future brand advocates, in order to build a passionate fan base that is active and regularly shares your content.

Content Strategy

Many organizations feel the need to  implement an editorial calendar to fill a content quota, but we recognize that without a strong content strategy this can be an incredibly wasteful investment.

 Content Writing

The content on your site tells your visitors who you are, encourages them to dig into your site .This content will be largely responsible for helping to attract visitors to your site.

Web Design & Development

Our team will help you identify industry influences and future brand advocates, in order to build a passionate fan base that is active and regularly shares your content.

Search Engine Optimization

Our team will help you identify industry influences and future brand advocates, in order to build a passionate fan base that is active and regularly shares your content.

WordPress Experts

We can create a beautiful, easy-to-use, custom site, or we can help you transfer your existing site to the best CMS on the Internet.

Our website design services are used by brands who are in need of a facelift. We design beautiful websites at affordable rates. Not only do the websites we develop look absolutely amazing, but we design them with your marketing goals in mind. High performing websites are focused on user experience, responsiveness across all devices, and clear call-to-actions to funnel traffic to your contact form or product page.

social ads guru digital marketin responsive design
Social Ads Guru Responsive Design

Our team firmly believes it is important to share what you know and to help others. We consult, hold workshops, speak at events, and offer IT support so we can to help spread some goodness in the world.

Our social media management services are designed to grow your brand’s online presence. We help your brand establish trust and build relationships with potential buyers. The benefits of using our social media management services consist of increased awareness, website traffic and lead generation. Additional benefits include influenced Google rankings, blog promotions, reputation management, and customer service to current and potential customers.

Web presence

We analyze yous business web page element as well as ranking on google.

Code Quality

We analyze your business web page code quality according to W3C standards.

Social Media Presence

We analyze social media presence and competitor using social data.

Social Ads Guru Analytics

SEO

We use web page analyzer for seo.

Brand Identity

We do brand identity analysis.

Google Trends

We use google trend facility based on Google search to show how often a particular search-term is entered .

Blog Blog

GURU DIARY
Why you should upgrade your Drupal to 8.8.0? – Open Source CMS New Releases

Drupal 8.8.0 — the last normal feature release of Drupal 8 — is now available for download. Some of the updates in this release include:

Stable Media Library:

The media library allows reuse of images, documents, videos and other digital assets across the website. The media library was previously a beta experimental module.

Media Library, experimental since Drupal 8.6.0, is a stable core module in Drupal 8.8.0. It does three main things:

  • Enhances the administrative media list page with a visual grid display of media thumbnails.
  • Allows users to select media for use in a field, or in a text editor, via a gorgeous, intuitive modal UI.
  • Enables authors to embed media items into text content, via the aforementioned gorgeous UI.

Experimental Administration Theme:

MOPRO CONTENT MANAGEMENT SYSTEM OVERVIEW

MoPro is a company Based in the USA, California and they offer services that include design, development and hosting your website. Not long time ago I had the chance to support on of sites hosted by MoPro on their servers and managed by their CMS.

Drupal 8 is out and it represents powerful new suite of tools
drupal-8-released
Drupal 8 represent powerful new suite of tools and the strongest link in content supply chain.

Drupal is an “out of the box” web content management tool and it represent high customizing platform – which help you build the right tool to serve your content management strategy.

Popular Travel #hashtags on Instagram

We are all curious about where other people are traveling and what are they researching and looking for on Social Media networks.

POPULAR-TRAVEL-HASHTAGS-min

Instagram rolls out its Live video feature in the U.S.

Instagram live video

Instagram’s latest features focus more on live streaming and less on photo sharing. On Monday, Instagram started rolling out its “Live” video-streaming feature to iOS and Android users in the U.S. The company first unveiled this feature in November, as a way to “connect with your friends and followers right now.” You will also be able to find popular Live videos in the Explore page. According to Instagram, Live will be available to everyone in the next few days.

Man Devotes His Life To Adopting Old Dogs Who Can’t Find Forever Homes

man-adopts-senior-dogs-shelter-steve-greig-51

Months kept passing after Steve Greig’s beloved dog died, but he still felt crushed. That’s when he decided he should give another dog a good life. But not just any dog. He went to his local shelter in Denver, Colorado to adopt the “least adoptable” senior dog, as these are the ones too often overlooked.

How to use Halloween marketing ideas for small business?

Halloween offers a unique opportunity for businesses to launch some fun and interesting marketing campaigns. This trend has expanded from USA to the whole world and each year we have the opportunity to catch some interesting ideas for promotion businesses.

Most interesting Tweets about Trump and power of hashtags

The campaign for United States presidential election of 2016 is in full swing and the elections are scheduled for Tuesday, November 8, 2016. These will be the 58th quadrennial U.S. presidential election.

Quick way to determine SoC’s GPU performance

 

Despite a common approach to employ usage of comprehensive benchmarks to determine performance of different hardware components of processing units, this if often not a great idea, mainly due to general limitations mentioned in my earlier blog post.

An alternative way to quickly predict the potential and a likely performance of a given GPU under stress in terms of its limits is to observe its raw „GFLOPs score. Although it isn’t a definite case, it is quite much a great predictor and it is definitely a great way to scope the potential of any given GPU.

What is Drupal and why should we use it?

drupal-8-released

Features of Drupal.

Drupal is number one platform for web content management among global enterprises, governments, higher education institutions, and NGOs. Flexible and highly scalable, Drupal publishes a single web site or shares content in multiple language across many devices. By using Drupal as solution business leaders transform their content management into powerful digital solutions.

CONTACT USCONTACT US

grow your business today

Contact Name (required)

Organization Name (required)

What Are Your Interests/Needs

Web site(required)

E-mail (required)

Your Message

Our ServicesOur Services

WHAT WE CAN DO

Social Media Strategy

Our team will help you identify industry influences and future brand advocates, in order to build a passionate fan base that is active and regularly shares your content.

Content Strategy

Many organizations feel the need to  implement an editorial calendar to fill a content quota, but we recognize that without a strong content strategy this can be an incredibly wasteful investment.

 Content Writing

The content on your site tells your visitors who you are, encourages them to dig into your site .This content will be largely responsible for helping to attract visitors to your site.

Web Design & Development

Our team will help you identify industry influences and future brand advocates, in order to build a passionate fan base that is active and regularly shares your content.

Search Engine Optimization

Our team will help you identify industry influences and future brand advocates, in order to build a passionate fan base that is active and regularly shares your content.

WordPress Experts

We can create a beautiful, easy-to-use, custom site, or we can help you transfer your existing site to the best CMS on the Internet.

Our website design services are used by brands who are in need of a facelift. We design beautiful websites at affordable rates. Not only do the websites we develop look absolutely amazing, but we design them with your marketing goals in mind. High performing websites are focused on user experience, responsiveness across all devices, and clear call-to-actions to funnel traffic to your contact form or product page.

social ads guru digital marketin responsive design
Social Ads Guru Responsive Design

Our team firmly believes it is important to share what you know and to help others. We consult, hold workshops, speak at events, and offer IT support so we can to help spread some goodness in the world.

Our social media management services are designed to grow your brand’s online presence. We help your brand establish trust and build relationships with potential buyers. The benefits of using our social media management services consist of increased awareness, website traffic and lead generation. Additional benefits include influenced Google rankings, blog promotions, reputation management, and customer service to current and potential customers.

Web presence

We analyze yous business web page element as well as ranking on google.

Code Quality

We analyze your business web page code quality according to W3C standards.

Social Media Presence

We analyze social media presence and competitor using social data.

Social Ads Guru Analytics

SEO

We use web page analyzer for seo.

Brand Identity

We do brand identity analysis.

Google Trends

We use google trend facility based on Google search to show how often a particular search-term is entered .

Blog Blog

GURU DIARY
Why you should upgrade your Drupal to 8.8.0? – Open Source CMS New Releases

Drupal 8.8.0 — the last normal feature release of Drupal 8 — is now available for download. Some of the updates in this release include:

Stable Media Library:

The media library allows reuse of images, documents, videos and other digital assets across the website. The media library was previously a beta experimental module.

Media Library, experimental since Drupal 8.6.0, is a stable core module in Drupal 8.8.0. It does three main things:

  • Enhances the administrative media list page with a visual grid display of media thumbnails.
  • Allows users to select media for use in a field, or in a text editor, via a gorgeous, intuitive modal UI.
  • Enables authors to embed media items into text content, via the aforementioned gorgeous UI.

Experimental Administration Theme:

MOPRO CONTENT MANAGEMENT SYSTEM OVERVIEW

MoPro is a company Based in the USA, California and they offer services that include design, development and hosting your website. Not long time ago I had the chance to support on of sites hosted by MoPro on their servers and managed by their CMS.

Drupal 8 is out and it represents powerful new suite of tools
drupal-8-released
Drupal 8 represent powerful new suite of tools and the strongest link in content supply chain.

Drupal is an “out of the box” web content management tool and it represent high customizing platform – which help you build the right tool to serve your content management strategy.

Popular Travel #hashtags on Instagram

We are all curious about where other people are traveling and what are they researching and looking for on Social Media networks.

POPULAR-TRAVEL-HASHTAGS-min

Instagram rolls out its Live video feature in the U.S.

Instagram live video

Instagram’s latest features focus more on live streaming and less on photo sharing. On Monday, Instagram started rolling out its “Live” video-streaming feature to iOS and Android users in the U.S. The company first unveiled this feature in November, as a way to “connect with your friends and followers right now.” You will also be able to find popular Live videos in the Explore page. According to Instagram, Live will be available to everyone in the next few days.

Man Devotes His Life To Adopting Old Dogs Who Can’t Find Forever Homes

man-adopts-senior-dogs-shelter-steve-greig-51

Months kept passing after Steve Greig’s beloved dog died, but he still felt crushed. That’s when he decided he should give another dog a good life. But not just any dog. He went to his local shelter in Denver, Colorado to adopt the “least adoptable” senior dog, as these are the ones too often overlooked.

How to use Halloween marketing ideas for small business?

Halloween offers a unique opportunity for businesses to launch some fun and interesting marketing campaigns. This trend has expanded from USA to the whole world and each year we have the opportunity to catch some interesting ideas for promotion businesses.

Most interesting Tweets about Trump and power of hashtags

The campaign for United States presidential election of 2016 is in full swing and the elections are scheduled for Tuesday, November 8, 2016. These will be the 58th quadrennial U.S. presidential election.

Quick way to determine SoC’s GPU performance

 

Despite a common approach to employ usage of comprehensive benchmarks to determine performance of different hardware components of processing units, this if often not a great idea, mainly due to general limitations mentioned in my earlier blog post.

An alternative way to quickly predict the potential and a likely performance of a given GPU under stress in terms of its limits is to observe its raw „GFLOPs score. Although it isn’t a definite case, it is quite much a great predictor and it is definitely a great way to scope the potential of any given GPU.

What is Drupal and why should we use it?

drupal-8-released

Features of Drupal.

Drupal is number one platform for web content management among global enterprises, governments, higher education institutions, and NGOs. Flexible and highly scalable, Drupal publishes a single web site or shares content in multiple language across many devices. By using Drupal as solution business leaders transform their content management into powerful digital solutions.