0
votes

Just to give you a brief intro on what am I trying to achieve.

I need to scrape a value for each month from a public website. As an example, for a particular status in the month of May, 2014; the TOTAL value is 224,481 (at the bottom right part of the page). I need to capture this value and store in the database for each of the month. The following URL will need to be run by changing the parameters for each month. VEEC Website with params

May Total

To achieve this, I am trying to get the HTML using CFHTTP as follows and then using JSOUP will scrape the intended value from the returned HTML before storing into the database.

<cfset f_url = "https://www.veet.vic.gov.au/Public/PublicRegister/Search.aspx">
    <cfhttp method="GET" url="#f_url#">
            <cfhttpparam type="Header" name="Accept-Encoding" value="*">
            <cfhttpparam type="Header" name="TE" value="deflate;q=0">
            <cfhttpparam name="CreatedFrom" type="URL"  value="#StartDate#">
            <cfhttpparam name="CreatedTo" type="URL"  value="#EndDate#">
            <cfhttpparam name="Status" type="URL"  value="PRP,PRV">
    </cfhttp>
<cfdump var="#cfhttp#">

I'm getting the connection failure error when I try to run the code snippet.

Please advise if there is an alternate way of doing the same. This has to be implemented just to gather data on the development side and not meant for production use.

Edit (Didn't want to Delete the question): I had to use the internet proxy to access the website in the CFHTTP tag to make it work. My bad for not checking it earlier. Hopefully, it might help someone in future. Thanks everyone.

1
Works for me. What do your StartDate and EndDate variables look like? Is the server you're running this able to connect to that URL? - duncan
The dates are declared in the normal csfet tags. Yes, although the url is accesible from the CF server; i'm thinking the issue is related to IIS. Any thoughts on the same and ways to debug this? - Gaurav S
declared how? As strings like 31-May-2014, as dates using CreateDate(), ...? This article may be relevant: coldfusionmuse.com/index.cfm/2013/7/22/coldfusion.iis8.cfhttp - duncan
Sorry, yeah as strings only. Thanks for the link Duncan, i will work on it tomorrow. - Gaurav S
What makes you think it is an issue related to IIS? - Scott Stroz

1 Answers

0
votes

Sounds like the classic secure cert thing.

CF has limited trust of secure certs. If the SSL cert at the destination you are calling is not one the CF likes, you will get a connection failure message. What you have to do is import the SSL cert in to the Java Keystore that CF is using.

Here is an old version of how to do it: http://mkruger.cfwebtools.com/index.cfm?mode=entry&entry=8E44925A-B73D-E3AD-709D4E02FD6D4588