True, but if there's no alternative you just have to swallow that.

In my case that was the only way I could get an ABN authenticated automatically.

Spike

Kola Oyedeji wrote:

Spike

Thanks, problem with this is if the site changes do you have to adjust your
regex?

Kola



-----Original Message-----
From: Spike [mailto:[EMAIL PROTECTED]
Sent: 09 July 2003 07:36
To: [EMAIL PROTECTED]
Subject: Re: [ cf-dev ] Getting exchange rates in CF5


You might be able to use cfhttp and some regular expressions to get the relevant data out of cfhttp.filecontent.

Funnily enough I did exactly that for an application yesterday checking
Australian Business Numbers.

Code below. You'll have to modify it so it's CF5 compatible, but
hopefully you should be able to get the idea:

<!--- **************************************************** --->

<cffunction name="checkAbn">
<cfargument name="abn" default="54 620 206 872">
<cfset var stripped = "">
<cfset var pass1 = "">
<cfset var stCompany = structNew()>
<cfset var aTmp = "">
<cfhttp method="POST"
url="http://www.abr.business.gov.au/(vcx2qe45qvmph5nxj2foom45)/We
bProcessEngine.aspx?pid=8000&amp;sid=0&amp;outcome=0">
<cfhttpparam type="FORMFIELD" name="__VIEWSTATE"
value="dDw1MzgxOztsPF9jdGwxOm1jdGxUZW1wbGF0ZU1pZGRsZUxlZnRMaW5rcz


pRdWlja1NlYXJjaEluTWVudTpRdWlja1NlYXJjaEJ1dHRvbjtfY3RsMTpfY3RsMDpBbGxOYW1lVH
lwZXNDaGVja2JveDtfY3RsMT>


pfY3RsMDpEZ3JDaGVja2JveDtfY3RsMTpfY3RsMDpUcmFkaW5nTmFtZXNDaGVja2J


veDtfY3RsMTpfY3RsMDpMZWdhbE5hbWVzQ2hlY2tib3g7X2N0bDE6X2N0bDA6TnN3Q2hlY2tib3g
7X2N0bDE6X2N0bDA6U2FDaGV>


ja2JveDtfY3RsMTpfY3RsMDpBY3RDaGVja2JveDtfY3RsMTpfY3RsMDpWaWNDaGVj


a2JveDtfY3RsMTpfY3RsMDpXYUNoZWNrYm94O19jdGwxOl9jdGwwOk50Q2hlY2tib3g7X2N0bDE6
X2N0bDA6UWxkQ2hlY2tib3g7>


X2N0bDE6X2N0bDA6VGFzQ2hlY2tib3g7X2N0bDE6X2N0bDA6QWxsU3RhdGVzQ2hlY


2tib3g7X2N0bDE6X2N0bDA6QWR2YW5jZWRTZWFyY2hCdXR0b247X2N0bDE6X2N0bDA6Q2xlYXJCd
XR0b247Pj4=">


    <cfhttpparam type="FORMFIELD" name="SIDInput" value="2">
    <cfhttpparam type="FORMFIELD" name="PIDInput" value="8000">
    <cfhttpparam type="FORMFIELD" name="OutcomeInput" value="0">
    <cfhttpparam type="FORMFIELD" name="ControlNameInput"
value="Application Controls\Search\AdvancedSearch.ascx">
    <cfhttpparam type="FORMFIELD"
name="_ctl1:_ctl0:AdvancedSearchTextbox" value="#arguments.abn#">
  </cfhttp>
  <cfset stripped = reFindNoCase('(<span
id="_ctl1__ctl0_DateRecordLastModified">.*?</p>)(.*?)(<hr size="1"
noshade>)',cfhttp.filecontent,1,true)>
  <cfif arrayLen(stripped.pos) GTE 3>
    <cfset pass1 =
mid(cfhttp.filecontent,stripped.pos[3],stripped.len[3])>

    <cfset tmp =
reReplaceNoCase(pass1,'(.*?)(<td.*?>)(.*?)(</td>)','|\3','all')>
    <cfset aTmp = listToArray(tmp,'|')>
    <cfloop from="1" to="#arrayLen(aTmp)#" index="i">
      <cfif right(aTmp[i],1) eq ":">
        <cfset j = i+2>
        <cfset stCompany[reReplaceNoCase(aTmp[i],'&nbsp;','','all')] =
ReReplaceNoCase(aTmp[j],'<.*?>','','all')>
      </cfif>
    </cfloop>
  </cfif>
  <cfreturn stCompany>
</cffunction>
<cfdump var="#checkAbn(abn='66 008 432 513')#">

<!--- **************************************************** --->

Spike

Kola Oyedeji wrote:



Hi

I have an application i'm building which requires up to date


exchange rates.


I'm using CF5 so i'm not sure if i'll be able to use web


services. Anyone


done anything like this with WDDX? Does anyone know where i can


find sites


providing exchange rates in WDDX packets?


Thanks


Kola






--
Stephen Milligan
Consultant for hire
http://www.spike.org.uk



--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]








-- Stephen Milligan Consultant for hire http://www.spike.org.uk



Reply via email to