What code did you try and insert?
Thread Starter
jas001
(@jas001)
[ Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum’s parser. Or use pastebin.com instead. ]
code for indeed.com XML
//Customize here...
$pubID = "579917657152129";
$niche = "health care administration";
$state = "arizona";
$img = "http://jobboards.jobstar.info/wp-content/uploads/2012/05/hiring1.png";
//Don't edit below here...
$nicheNice = ucwords(preg_replace("/+/", " ", $niche));
$nicheUgly = preg_replace("/ /", "+", $niche);
$userip = $_SERVER['REMOTE_ADDR'];
$useragent = urlencode($_SERVER['HTTP_USER_AGENT']);
$toGet = "http://api.indeed.com/ads/apisearch?";
$inputdata = array();
$inputdata[] = "publisher=$pubID";
$inputdata[] = "v=2";
$inputdata[] = "format=xml";
$inputdata[] = "callback=";
$inputdata[] = "q=$nicheUgly";
$inputdata[] = "l=$state";
$inputdata[] = "sort=relevance";
$inputdata[] = "radius=25";
$inputdata[] = "st=";
$inputdata[] = "jt=";
$inputdata[] = "start=0";
$inputdata[] = "limit=11";
$inputdata[] = "fromage=30";
$inputdata[] = "highlight=0";
$inputdata[] = "filter=1";
$inputdata[] = "latlong=";
$inputdata[] = "co=us";
$inputdata[] = "chnl=";
$inputdata[] = "userip=$userip";
$inputdata[] = "useragent=$useragent";
$query = implode("&", $inputdata);
$jobs = simplexml_load_file($toGet.$query);
$jobDetails = array('Job','Work','Career Opportunity','Hiring','Work','Hiring','Hiring','Job Opportunity','Work','Hiring','Hiring','Job Opportunity','Career Opportunity','Local Job','Job Opportunity','New Job');
$i = "1";
foreach ($jobs->results->result as $jobinfo){
if ($i <= "10"){
$title = $jobinfo->jobtitle;
$company = $jobinfo->company;
$snippet = ucfirst($jobinfo->snippet);
$loc = $jobinfo->formattedLocationFull;
$jobCity = $jobinfo->city;
$jobState = $jobinfo->state;
$jobkey = $jobinfo->jobkey;
$jobURL = $jobinfo->url;
$jobDetail = $jobDetails[$i];
if ($i == 1){
$jobDetailMargin = "margin:0 0 10px 0;";
} else {
$jobDetailMargin = "margin:15px 0 15px 0;";
}
if ($i == 1){
echo <<<x
<div style="margin:10px 0 10px 0; font-weight:bold; font-size:14px;">» <a href="http://www.indeed.com/jobs?q=$nicheUgly&l=&indpubnum=$pubID">View ALL $nicheNice job listings</a></div>
x;
}
if ($i == 9){
echo <<<x
<div style="text-align:center; padding:5px 0 5px 0; height:175px;"><img src="$img"></div>
x;
}
echo <<<x
<div style="$jobDetailMargin line-height:18px; border:solid 1px #cccccc; background:#f5f5f5; padding:5px 10px 5px 10px;">
<div><strong><a href="$jobURL">$title</a></strong></div>
<div><b>Located in $loc.</b> $jobDetail Details: $snippet</div>
<div style="color:#3A8041; font-size:11px;">Employer: $company</div>
</div>
x;
$i++;
} else {
break;
}
}
if ($i >= 2){
echo "<div style='margin:10px 0 10px 0; font-weight:bold; font-size:14px;'>» <a href='http://www.indeed.com/jobs?q=$nicheUgly&l=&indpubnum=$pubID'>View more $nicheNice job listings</a></div><div style='text-align:right;'><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.indeed.com/p/jobsearch.gif' style='border: 0; vertical-align: middle;' alt='Indeed job search' title='Job Search'></a></span></div>";
} else {
echo "<div><strong>No jobs found.</strong> Please broaden your search...</div>";
}
any suggestions..
Thanks
Im sure pastebin might have been a better choice than just pasting it in here, the forum makes it unreadable.
Anyway id put all that in a shortcode or something…
Line 7:
$nicheNice = ucwords(preg_replace("/+/", " ", $niche));
your expression is basically + and + in PCRE means repeat. so repeat nothing! If you want it to match the + you need to escape it:
$nicheNice = ucwords(preg_replace("/\+/", " ", $niche));
Thread Starter
jas001
(@jas001)
Oh, Thank your very much Mr. Simon its working…
Thanks agian
Thread Starter
jas001
(@jas001)
Can i delete the code above..?
Im sure a moderator might do that for you, i tagged it so they see it.
Thread Starter
jas001
(@jas001)
Thanks for your kindness simon,,,