ripcurl /sampleScripts/kenexa.php

Language PHP Lines 49
MD5 Hash 7c9056121eeb49277c50f623b67a8d3d Estimated Cost $609 (why?)
Repository https://bitbucket.org/linuxdream/ripcurl View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
require_once('ripcurl.class.php');
//Instantiate ripcurl object
$rip = new ripcurl();
//Fetch initial page for cookie and session data
$rip->ripRun('https://recruiter.kenexa.com/providence/cc/Home.ss?ccid=bupJEdUjsTs%3D',1);
//Hidden form so let's grab that data since everything is a form submit
$elements = $rip->getFormElements('form');
//Assign out ccid since that seems to be used a lot
$ccid = urlencode($elements['ccid']);
//Fetch second page - Search Page
$rip->ripRun('https://recruiter.kenexa.com/providence/cc/CCJobSearchAction.ss?command=CCSearchPage&ccid='.$ccid, 1, $elements);
//Grab form data again
$elements = $rip->getFormElements('form');
//Set result page url since this might chnge with pagination
$url = 'https://recruiter.kenexa.com/providence/cc/CCJobSearchAction.ss?command=CCSearchNow';
//Begin pagination
do{
	//Save initial result for pagination test later
	$html = $rip->ripRun($url, 1, $elements);
	//Grab form data again
	$elements = $rip->getFormElements('form');
	//Grab jobs
	$jobs = $rip->getWeirdLinks('job_JOB_TITLE_ID_onClick');
	//Need just the jobid
	foreach($jobs as $job){
		$jobid = $rip->ripInBetween("'", "'", null, $job);
		//Change value of this element to job id
		$elements['job_REQUISITION_NUMBER'] = $jobid[0];
		//Get job page
		$rip->ripRun('https://recruiter.kenexa.com/providence/cc/CCJobResultsAction.ss?command=ViewJobDetails&job_REQUISITION_NUMBER='.$jobid[0], 1, $elements);
		//Echo out the job
		echo $rip->getRawHtml();
	}
	//Check if there is a next page and set the proper variables
	if(preg_match('|<a(.*?)image91(.*?)</a>|', $html, $matches)){
		//Grab next page number and assign it to POST PageNumber
		$page = $rip->ripInBetween('\(', '\)', null, $matches[1]);
		$page = $page[0];
		$elements['PageNumber'] = $page;
		//Construct URL for next page
		$url = 'https://recruiter.kenexa.com/providence/cc/CCJobResultsAction.ss?command=MoveToPage';
	}else{
		//Next page not found, make null to break the loop
		$url = null;
	}
}while(!is_null($url));
?>
Back to Top