Solved

CFHTTP not getting the search results page I need.

Posted on 2003-11-03
10
268 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
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…

813 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

17 Experts available now in Live!

Get 1:1 Help Now