Solved

CFHTTP not getting the search results page I need.

Posted on 2003-11-03
10
270 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
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 
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
 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

856 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