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

Extracting Data Out of cfhttp.fileContent Object

Guest
Apr 22, 2006 Apr 22, 2006

Copy link to clipboard

Copied

Guys i am sure you will come up with nice idea .
please have a look at this URL . http://wwwapps.ups.com/tracking/tracking.cgi?tracknum=1Z6706320354622939

Its returning package information about any ups package . i am retereiving this page throught <cfhttp> after then trying to just filter out Tracking Number | Status | Delivery information out of this whole page. i think i am running out of ideas . one idea is to clean html Tags using ReReplace even then how can i just extract the only required info ?
TOPICS
Advanced techniques

Views

1.2K

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

correct answers 1 Correct answer

LEGEND , Apr 24, 2006 Apr 24, 2006
flooker wrote:
> If i am understanding you correct You are suggesting Flow some thing like . in
> IM clinet issue Command : that will invoke CFC which will send and e-mail to
> UPS along with all tracking number : my POP3 will receive reply mail , and then
> i can use that to display results in IM Clent. (Is not Time here an issue.) i

as i asked before, "what's the email lag?" i guess versus "how many times does
the cfhttp page scrapping fail?" or "how much time can you devote to monitorin...

Votes

Translate

Translate
Advisor ,
Apr 22, 2006 Apr 22, 2006

Copy link to clipboard

Copied

The answer is, don't do it.
Here are some options most to least preferable:
  1. Don't use UPS. They blow. Even the US post office is better.
  2. Sign up for and use UPS' web interface. See http://www.ups.com/e_comm_access/gettools_index?loc=en_US .
  3. Parse the html, as you are asking about. Since the UPS site is crappy, table-layout html with poor "content id"; you will have a rough go and will have to adjust your code every time UPS tweaks their site.

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
Guest
Apr 22, 2006 Apr 22, 2006

Copy link to clipboard

Copied

well some how nasty solution is as followed ..

<cfhttp url=" http://wwwapps.ups.com/tracking/tracking.cgi" method="get">
<cfhttpparam name = "tracknum" type = "URL" value = "#track#">
</cfhttp>

<cfset hello = REReplace(#cfhttp.fileContent#, "<[^>]*>", "", "All")>

<cfset b = find("Status",#hello#)>
<cfset c = find("Eastern Time",#hello#)>
<cfset count = val(#c#) - val(#b#) >
<cfset res = mid(#hello#,#b#,#count#)>
<cfset res = wrap(#res#,400,true)>
<cfset res = REReplace(#res#, " ", "", "All")>

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
Advisor ,
Apr 22, 2006 Apr 22, 2006

Copy link to clipboard

Copied

Oh yeah, what about 1Z6706320354622940?

What happens if your server gets moved out of eastern time?

Thank you for posting a perfect example, that I can link to, of how NOT to attack a problem like this.

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
Guest
Apr 22, 2006 Apr 22, 2006

Copy link to clipboard

Copied

you are absolutly right . that's why i said " nasty solution" . what i posted is just a work around . i know its not A best solution .

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
LEGEND ,
Apr 22, 2006 Apr 22, 2006

Copy link to clipboard

Copied

flooker wrote:
> Guys i am sure you will come up with nice idea .
> please have a look at this URL .
> http://wwwapps.ups.com/tracking/tracking.cgi?tracknum=1Z6706320354622939

why not give their email tracking a shot? it says it returns plain text.

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
Guest
Apr 23, 2006 Apr 23, 2006

Copy link to clipboard

Copied

PauIH : thanks for reply but scope of problem is little different . what i am doing is to display the result (tracking info) with in IM client like Google talk using CF gateway . and rest of the processing using CFHTTP is hapenning within CFC . so i am afraid e-mail wont help . within IM the user will send a command like show | tracking number and then gateway will respondback with information . i am displaying the results i mean its working fine but DIV or Span Tags of Ups web site are not consistant thats is why i am facing some trouble .

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
LEGEND ,
Apr 23, 2006 Apr 23, 2006

Copy link to clipboard

Copied

flooker wrote:
> PauIH : thanks for reply but scope of problem is little different . what i am
> doing is to display the result (tracking info) with in IM client like Google

what's the email lag? you could very easily build (or borrow, there's code in
the advanced cf book) a POP3 gateway to handle incoming email. combining
gateways is fairly easy & a real force multiplier.

i've done loads of screen/page scraping apps (mainly from gov sites it seems) &
you'll be constantly in motion responding to every little twitch some junior
developer makes. MikerRoo's advice is sound.

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
Guest
Apr 24, 2006 Apr 24, 2006

Copy link to clipboard

Copied

If i am understanding you correct You are suggesting Flow some thing like . in IM clinet issue Command : that will invoke CFC which will send and e-mail to UPS along with all tracking number : my POP3 will receive reply mail , and then i can use that to display results in IM Clent. (Is not Time here an issue.) i mean user sending command and then at the back end CFC is waiting for the mail to arrive to process it evetually ? please correct the flow if i am missing some thing .


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
LEGEND ,
Apr 24, 2006 Apr 24, 2006

Copy link to clipboard

Copied

flooker wrote:
> If i am understanding you correct You are suggesting Flow some thing like . in
> IM clinet issue Command : that will invoke CFC which will send and e-mail to
> UPS along with all tracking number : my POP3 will receive reply mail , and then
> i can use that to display results in IM Clent. (Is not Time here an issue.) i

as i asked before, "what's the email lag?" i guess versus "how many times does
the cfhttp page scrapping fail?" or "how much time can you devote to monitoring
their return page & reacting to changes?" i guess the answer is test the email
lag & see how easy it is to parse & more importantly how reliable the data is.

> mean user sending command and then at the back end CFC is waiting for the mail
> to arrive to process it evetually ? please correct the flow if i am missing
> some thing .

a gateway listener is waiting on the backend, it would IM the user. grab the
basic POP3 gateway code from chapter 31's source code here:
http://www.forta.com/books/0321292693/

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
Guest
Apr 24, 2006 Apr 24, 2006

Copy link to clipboard

Copied

Mail Lag is around 20-30 Sec, Which i however no good . but i am working on Concept you gave me it really makes sense.
thanks Again .

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
LEGEND ,
Apr 24, 2006 Apr 24, 2006

Copy link to clipboard

Copied

flooker wrote:
> Mail Lag is around 20-30 Sec, Which i however no good . but i am working on Concept you gave me it really makes sense.
> thanks Again .

yeah that's too slow but you're still at the mercy of that website's
developers. there's no RSS/webservice/etc?

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
Advisor ,
Apr 24, 2006 Apr 24, 2006

Copy link to clipboard

Copied

Of course there's a web service.
You get it at the link i provided above.

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
LEGEND ,
Apr 24, 2006 Apr 24, 2006

Copy link to clipboard

Copied

LATEST
MikerRoo wrote:
> Of course there's a web service.
> You get it at the link i provided above.

then why all the goop about parsing html pages?

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