Skip to main content
Inspiring
October 4, 2007
Question

cfhttp user-agent question

  • October 4, 2007
  • 1 reply
  • 472 views
I'm trying to get some information off a page. The info I want is on:
https://www.memberst.com/Programs/SessionDetails.aspx?id=A00277BF-262C-4C2A-8FAA-58AAB8465589&sid=601275

and its the section that says x of 10 (last I checked it said 8 of 10).

I'm using the following code:

cfhttp method="get"
url="https://www.memberst.com/Programs/SessionDetails.aspx?id=A00277BF-262C-4C2A-8FAA-58AAB8465589&sid=601275"
useragent="Mozilla/4.0">
</cfhttp>

<cfset txt=cfhttp.FileContent>

<cfset re = ([-+]?\d+).*?(of).*?(10)>
<cfset m = #REFindNoCase(#re#,#txt#,1,"TRUE")#>
<cfif #ArrayLen(m.pos)# gt 1>
<cfset int1=#Mid(txt,m.pos[2],m.len[2])#>
<cfset word1=#Mid(txt,m.pos[3],m.len[3])#>
<cfset int2=#Mid(txt,m.pos[4],m.len[4])#>
<cfoutput>
(#replace(int1,"<" ,"&lt;")#)(#replace(word1,"<"
,"&lt;")#)(#replace(int2,"<" ,"&lt;")#)
</cfoutput>
</cfif>

But it seems that the cfhttp is not using the user-agent, as I get back
10px; when I dump out 1 of the locations......

Any suggestions??

    This topic has been closed for replies.

    1 reply

    Inspiring
    October 5, 2007
    Anyone have any ideas??? Thoughts??

    "Steve Grosz" <boise_bound@hotmail.com> wrote in message
    news:fe3jd7$6nl$1@forums.macromedia.com...
    > I'm trying to get some information off a page. The info I want is on:
    > https://www.memberst.com/Programs/SessionDetails.aspx?id=A00277BF-262C-4C2A-8FAA-58AAB8465589&sid=601275
    >
    > and its the section that says x of 10 (last I checked it said 8 of 10).
    >
    > I'm using the following code:
    >
    > cfhttp method="get"
    > url="https://www.memberst.com/Programs/SessionDetails.aspx?id=A00277BF-262C-4C2A-8FAA-58AAB8465589&sid=601275"
    > useragent="Mozilla/4.0">
    > </cfhttp>
    >
    > <cfset txt=cfhttp.FileContent>
    >
    > <cfset re = ([-+]?\d+).*?(of).*?(10)>
    > <cfset m = #REFindNoCase(#re#,#txt#,1,"TRUE")#>
    > <cfif #ArrayLen(m.pos)# gt 1>
    > <cfset int1=#Mid(txt,m.pos[2],m.len[2])#>
    > <cfset word1=#Mid(txt,m.pos[3],m.len[3])#>
    > <cfset int2=#Mid(txt,m.pos[4],m.len[4])#>
    > <cfoutput>
    > (#replace(int1,"<" ,"&lt;")#)(#replace(word1,"<"
    > ,"&lt;")#)(#replace(int2,"<" ,"&lt;")#)
    > </cfoutput>
    > </cfif>
    >
    > But it seems that the cfhttp is not using the user-agent, as I get back
    > 10px; when I dump out 1 of the locations......
    >
    > Any suggestions??
    >
    >