Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking to loop thru CFLOCATION

Status
Not open for further replies.

jmcg

Technical User
Joined
Jun 30, 2000
Messages
223
Location
GB
I am looking for a method of looping through some code to call a CFLOCATION.
I am try to send a SMS message to a variety of user and this needs to be done one at a time. When I try a loop with CFLOCATION it only processes the first result and moves to the SMS page and then stops. How can I get it to go to this site while still continuing the loop?
 
Using a <cflocation> will short-circuit the processing of the loop, since it exits the page altogether. If you have another page that you need to execute a bunch of times with different parameters, try calling it with <cfhttp>. This doesn't navigate to a different page the way <cflocation> does, so you can execute it multiple times in a single page.

You can use <cfhttp> to execute a POST, and within the <cfhttp> tag use <cfhttpparam> tags to specify the form fields to send.

If you set the TIMEOUT attribute on the <cfhttp> tag to zero, CF won't wait for a response from the page being called, so your code will run faster (otherwise, execution time on this page could quickly get huge). In this case, though, CF will throw an error on every call to <cfhttp> which you would have to catch with <cftry> and <cfcatch>
tags. This is only good if you want the calling page to run faster and don't care whether the called page is successful.
 
Thanks, CFHTTP worked perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top