Wordpress template code to search and insert job details using api

Following Wordpress plugin shortcode is used to search and insert job details from indeed.com. This template is designed based on indeed.com job search API. Please signup for API key before using this template.

Following code assumes jobkey id is passed as parameter to get corresponding job details. Refer post to get job id from indeed.com API forum.indiacitys.com/index.php?p=/discussion/50/wordpress-php-template-code-to-search-and-get-job-post-ids-from-indeed-com#latest

<?php /* Plugin Name: insertjobsdetailsindeed Description: Insert jobs details indeed Version: 0.1 Author: http://forum.indiacitys.com */ function insertjobsdetindeed($atts) { $jobkey = $atts[jobkey]; $ipaddr = $_SERVER['REMOTE_ADDR']; $useragent = $_SERVER['HTTP_USER_AGENT']; $useragent = urlencode($useragent); $eventurl = 'http://api.indeed.com/ads/apigetjobs?publisher=<--yourapikeyhere--->&jobkeys='.$jobkey.'&v=2'; $string = file_get_contents($eventurl); $jobs = new SimpleXMLElement($string); $event = $jobs->results->result; $event_src = $event->url; $event_loc = $event->formattedLocation; echo '<a href="'.$event_src.'" target="_blank" ><h1>'.$event->jobtitle.'</h1></a><br><br><b>Description :</b><br>'.$event->snippet.'<br><br>'.$event->company.'<a href="'.$event_src.'" target="_blank" onMouseDown="indeed_clk(this);"><b>Posted by : </b>'.$event->company.'</a><br><br><b>Location : </b>'.$event->city.','.$event->state.','.$event->country.'<br><br><b>Posted on: </b>'.$event->date.'<br><br><a href="'.$event_src.'" target="_blank" onMouseDown="indeed_clk(this);"><h3>Apply for job now</h3></a><br><br><span id=indeed_at><a href="http://www.indeed.com/">jobs</a> by <a href="http://www.indeed.com/" title="Job Search"><img src="http://www.muraliwebworld.com/indeed.gif" style="border: 0;vertical-align: middle;" alt="Indeed job search"></a></span><hr>'; return; } add_shortcode('insertjobsindeed', 'insertjobsdetindeed'); ?>
Sign In or Register to comment.