Solved

CFHTTP not getting the search results page I need.

Posted on 2003-11-03
10
273 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

759 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