Solved

CFHTTP not getting the search results page I need.

Posted on 2003-11-03
10
260 Views
Last Modified: 2013-12-24
I'm trying to get search results from Dice.com using the code below:

-----------------------------
<cfhttp method = "POST" url = "http://seeker.dice.com/jobsearch/servlet/JobSearch" resolveurl="yes">
      <cfhttpparam name = "PREV_DOC" type = "FormField" value = "31">
      <cfhttpparam name = "NEXT_DOC" type = "FormField" value = "91">
      <cfhttpparam name = "op" type = "FormField" value = "1000">
      <cfhttpparam name = "FILTER_TEXT" type = "FormField" value = "">
</cfhttp>

<CFOUTPUT>
content = #cfhttp.filecontent# <BR>
mimetype = #cfhttp.mimeType# <BR>
header = #cfhttp.header# <BR>
</cfoutput>
------------------------------

The source code in Dice.com uses hidden form fields to post data to page through search results and I copied the form fields and used the CFHTTP Post code above but it takes me to page 1 of the search results instead of page 2.

Any ideas?

Thanks,

Johnny G.
0
Comment
Question by:javanigus
  • 4
  • 3
  • 3
10 Comments
 
LVL 17

Expert Comment

by:anandkp
ID: 9670028
try

<cfhttp method = "POST" url = "http://seeker.dice.com/jobsearch/servlet/JobSearch" method="post">
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9670037
Sorry - i meant this

<cfhttp method = "POST" url = "http://seeker.dice.com/jobsearch/servlet/JobSearch">
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9670087
hmmm - r u sure u have all the possible form fields included there ... i cldnt seem to get it to work from my place !
0
 
LVL 4

Accepted Solution

by:
procept earned 250 total points
ID: 9670604
Hi,

<ou need two add two more form fields:

<cfhttpparam name = "NEXT.x" type = "FormField" value = "5">
<cfhttpparam name = "NEXT.y" type = "FormField" value = "7">

Please note: the names of the form fields are case sensitive!!!

Explanation: The next button is an <input type="image">. When that is clicked, it generates two fields that contain an x-position and an y-position. Without those elements the servlet assumes it has to display the first page.

HTH,

Chris
0
 

Author Comment

by:javanigus
ID: 9674564
Chris, you did it again! Thanks man! I actually modified the code to look as follows:

-------------------------------
<cfhttp method = "POST" url = "http://seeker.dice.com/jobsearch/servlet/JobSearch" resolveurl="yes">
      <!--- <cfhttpparam name = "PREV_DOC" type = "FormField" value = "1"> --->
      <cfhttpparam name = "NEXT_DOC" type = "FormField" value = "31">
      <cfhttpparam name = "op" type = "FormField" value = "1000">
      <cfhttpparam name = "FILTER_TEXT" type = "FormField" value = "">
      <cfhttpparam name = "NEXT.x" type = "FormField" value = "5">
      <cfhttpparam name = "NEXT.y" type = "FormField" value = "7">

</cfhttp>

<CFOUTPUT>
content = #cfhttp.filecontent# <BR>
mimetype = #cfhttp.mimeType# <BR>
header = #cfhttp.header# <BR>
</cfoutput>
--------------------------
The PREV_DOC field isn't necessary for what I'm doing and I can programmatically page through search results by changing the NEXT_DOC field to 0, 31, 61, 91, .....

Thanks again.

Johnny G.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 17

Expert Comment

by:anandkp
ID: 9676211
Cool ... Chris ... how did u get to know abt the other 2 missing parameters .... !
0
 
LVL 4

Expert Comment

by:procept
ID: 9676840
Johnny, you're welcome. :-))

Anand: Just played around... did a cfhttp to result page 1, changed the form action to my site, clicked "Next"  and on the action let the form var dump... it showed all the form fields plus NEXT.x and NEXT.y. If you play around with the "op" field (only lower case field btw.), you'll get some weird results, too... sometimes incomplete content, sometimes "Job no lomger exists" msgs.... ;-))

Chris
0
 

Author Comment

by:javanigus
ID: 9705389
Chris, can you show me the code for how you found the Next.x and Next.y fields? The action page.

thanks,

Johnny G.
0
 
LVL 4

Expert Comment

by:procept
ID: 9706474
sure. :-)

I did a cfhttp, changed the action of the form to my local page and clicked on "next". On the action page I just dumped the form and compared the result with the posted form fields, that's it...

<!--- if there is no "form.prev_doc", request the page from dice.com and display it --->
<cfif NOT IsDefined("form.prev_doc")>
   <cfhttp method = "POST" url = "http://seeker.dice.com:80/jobsearch/servlet/JobSearch" resolveurl="yes">
        <cfhttpparam name = "PREV_DOC" type = "FormField" value = "1">
        <cfhttpparam name = "NEXT_DOC" type = "FormField" value = "61">
        <cfhttpparam name = "op" type = "FormField" value = "1000">
        <c  fhttpparam name = "FILTER_TEXT" type = "FormField" value = "">
   </cfhttp>


   <!--- in the displayed page, replace the form action with the URL of this page;
           manually click on next button in the page  --->
   <cfoutput>
      #replaceNoCase(cfhttp.filecontent, "http://seeker.dice.com:80/jobsearch/servlet/JobSearch", cgi.script_name, "all")#
   </cfoutput>

<!--- there is a for var: page was displayed and we clicked a button; dump the contents of the form --->
<cfelse>
   <cfdump var="#form#">
</cfif>


HTH,

Chris

0
 

Author Comment

by:javanigus
ID: 9707672
Oh, ok. got it. I had never used and didn't know about the <CFDUMP> function so I wasn't sure what you meant by dumping the form variable but now I know.

Thanks,

Johnny
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now