Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 279
  • Last Modified:

CFHTTP not getting the search results page I need.

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
javanigus
Asked:
javanigus
  • 4
  • 3
  • 3
1 Solution
 
anandkpCommented:
try

<cfhttp method = "POST" url = "http://seeker.dice.com/jobsearch/servlet/JobSearch" method="post">
0
 
anandkpCommented:
Sorry - i meant this

<cfhttp method = "POST" url = "http://seeker.dice.com/jobsearch/servlet/JobSearch">
0
 
anandkpCommented:
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
proceptCommented:
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
 
javanigusAuthor Commented:
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
 
anandkpCommented:
Cool ... Chris ... how did u get to know abt the other 2 missing parameters .... !
0
 
proceptCommented:
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
 
javanigusAuthor Commented:
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
 
proceptCommented:
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
 
javanigusAuthor Commented:
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now