Tuesday 3 July 2012

how to call indeed api in classic asp


<%@LANGUAGE="VBSCRIPT"%>

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en" lang="en">
<head>

<title>Indeed Api Call</title>
<meta name="title" content="testing" />
</head>
<body>
<div class="vevent">
 
   <%
   dim use
 use=Request.ServerVariables("HTTP_USER_AGENT")
  if request("fj") <>"" then
  as_and=request("as_and")
 as_phr=request("as_phr")
 as_any=request("as_any")
  as_not=request("as_not")
 as_ttl=request("as_ttl")
 as_cmp=request("as_cmp")
 jt=request("jt")
   st=request("st")
  salary=request("salary")
   radius=request("radius")
     l=request("l")
  fromage=request("fromage")
  limit=request("limit")
   sort=request("sort")

Dim req
Set req = Server.CreateObject("MSXML2.ServerXMLHTTP")

req.open "GET", "http://api.indeed.com/ads/apisearch?publisher=9116108067858202&q="&as_and&"&as_phr="&as_any&"&as_not="&as_not&"&l="&l&"&as_ttl="&as_ttl&"&sort="&sort&"&radius=&st="&st&"&jt="&jt&"&start=&limit="&limit&"&fromage="&fromage&"&filter=&latlong=1&co=us&chnl=&userip=1.2.3.4&useragent="&use&"&v=2", False
req.send()

Set objXML = Server.CreateObject("Microsoft.XMLDOM")
 Set objLst = Server.CreateObject("Microsoft.XMLDOM")
 Set objHdl = Server.CreateObject("Microsoft.XMLDOM")
 objXML.async = False
 objXML.Load (req.responseXml)
 Set xml_tree2 = objXML.getElementsByTagName("result")
 dim a:a=req.responseXml.xml
Set xml_tree1 = Nothing
%>
<div style=" min-height:500px; width:500px;">
<%
for i = 0 to (xml_tree2.length - 1)
    set xml_tree3 = xml_tree2.item(i)
    test=    isobject(xml_tree3.childnodes(9))
    IF isobject(xml_tree3.childnodes(9)) AND  isobject(xml_tree3.childnodes(0)) AND  isobject(xml_tree3.childnodes(8)) AND  isobject(xml_tree3.childnodes(16)) AND isobject(xml_tree3.childnodes(17)) THEN
    response.write( "<a href='"&xml_tree3.childnodes(9).text&"' >"&xml_tree3.childnodes(0).text&"</a><br>")
    response.write(xml_tree3.childnodes(8).text&"<bR>")
  response.write(xml_tree3.childnodes(16).text&"<bR>")  
    response.write("<font style='color:#20f120;'>"&xml_tree3.childnodes(17).text&"</font><bR>")
   
   end if
   next


    %>

  </div>
  <% end if %>
</div>
<%   if request("fj") ="" then %>>
<form >

<table cellspacing="0" cellpadding="3" border="0" align="center">
<tbody><tr>
<td><h1>Advanced Job Search</h1></td>
</tr>
<tr>
<td>

<table cellspacing="0" cellpadding="3" border="0">
<tbody><tr><td colspan="2" class="header">Find Jobs</td></tr>
<tr>
<td width="150" nowrap=""><label for="as_and">With <b>all</b> of these words</label></td>
<td><input type="text" value="" maxlength="512" size="35" name="as_and" id="as_and"></td>
</tr>
<tr>
<td nowrap=""><label for="as_phr">With the <b>exact phrase</b></label></td>
<td><input type="text" value="" maxlength="512" size="35" name="as_phr" id="as_phr"></td>
</tr>
<tr>
<td nowrap=""><label for="as_any">With <b>at least one</b> of these words</label></td>
<td><input type="text" value="" maxlength="512" size="35" name="as_any" id="as_any"></td>
</tr>
<tr>
<td nowrap=""><label for="as_not">With <b>none</b> of these words</label></td>
<td><input type="text" value="" maxlength="512" size="35" name="as_not" id="as_not"></td>
</tr>
<tr>
<td nowrap=""><label for="as_ttl">With these words in the <b>title</b></label></td>
<td><input type="text" value="" maxlength="512" size="35" name="as_ttl" id="as_ttl"></td>
</tr>
<tr>
<td nowrap=""><label for="as_cmp">From this <b>company</b></label></td>
<td><input type="text" value="" maxlength="512" size="35" name="as_cmp" id="as_cmp"></td>
</tr>


<tr>
<td nowrap=""><label for="jt">Show jobs of type</label></td>
<td>
<select name="jt" id="jt">
<option value="all">All job types</option>
                         
                            <option value="fulltime">Full-time</option>
                         
                            <option value="parttime">Part-time</option>
                         
                            <option value="contract">Contract</option>
                         
                            <option value="internship">Internship</option>
                         
                            <option value="temporary">Temporary</option>
                         
</select>
</td>
</tr>

<tr>
<td nowrap=""><label for="st">Show jobs from</label></td>
<td>
<select name="st" id="st">
<option value="">All web sites</option>
<option value="jobsite">Job boards only</option>
<option value="employer">Employer web sites only</option>
</select>
</td>
</tr>
<tr>
<td nowrap="">&nbsp;</td>
<td>
<input type="checkbox" value="directhire" name="sr" id="norecruiters">&nbsp;<label for="norecruiters">Exclude staffing agencies</label>
</td>
</tr>





<tr id="sal_item">
<td style="vertical-align:top" class="col_a"><label for="salary">Salary estimate</label></td>
<td><table cellspacing="0" cellpadding="0"><tbody><tr><td><input type="text" size="17" value="" name="salary" id="salary"> per year</td></tr><tr><td><span style="font-size:smaller;color:#666" class="example">$50,000 or $40K-$90K</span></td></tr></tbody></table></td>
</tr>


<tr><td colspan="2" class="header">Where and When</td></tr>
<tr>
<td nowrap="" colspan="1" style="padding:5px 3px;">
                     
<label for="radius"><b>Location</b></label>&nbsp;
<select name="radius" id="radius">


<option value="0">only in</option>






<option value="5">within 5 miles of</option>






<option value="10">within 10 miles of</option>






<option value="15">within 15 miles of</option>






<option value="25" selected="">within 25 miles of</option>






<option value="50">within 50 miles of</option>






<option value="100">within 100 miles of</option>



</select>&nbsp;
                    </td>
                    <td>
<input type="text" value="" maxlength="250" size="28" name="l" id="where" autocomplete="off">&nbsp;(city, state, or zip)

</td>
</tr>
                <tr><td></td><td class=""><div style="position:relative;z-index:2"><div style="display:none;" class="acd" id="acdiv"></div></div></td></tr>
<tr>
<td nowrap="" colspan="2" style="padding:5px 3px;">
<b>Age</b> - <label for="fromage">Jobs published</label>&nbsp;
<select name="fromage" id="fromage">
<option value="any">anytime</option>
                         
                                <option value="15">within 15 days</option>
                         
                                <option value="7">within 7 days</option>
                         
                                <option value="3">within 3 days</option>
                         
                            <option value="1">since yesterday</option>
   <option value="last">since my last visit</option>

</select>
</td>  
</tr>
<tr>
<td nowrap="" colspan="2" style="padding:5px 3px;">
<label for="limit"><b>Display</b></label>&nbsp;
<select name="limit" id="limit">
                         
                            <option value="10" selected="">10</option>
                         
                            <option value="20">20</option>
                         
                            <option value="30">30</option>
                         
                            <option value="50">50</option>
                         
</select>
&nbsp;results per page, <label for="sort">sorted by</label>&nbsp;
<select name="sort" id="sort">
<option value="" selected="">relevance</option>
<option value="date">date</option>
</select>
&nbsp;&nbsp;&nbsp;<input type="submit" value="Find Jobs"  name="fj" id="fj">
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
    </form>
    <% end if %>
</body>

</html>