domains gotomyjob.com, first local database, phpmyadmin=> INSERT INTO `prio` ( `id` , `source1` , `priority` ) VALUES (NULL , 'XXXXXXputHere$source', '0'); $_GET['bx']=1;//1 means no DB insert $testmode=1;//stop looping at 5th result $local_debug=0;//0 means open website location, 1 means read data file from local server //###debug-end### include "func.php"; $counter=1; $source="jobbuilding.be"; $company="Job Building"; $today=getdate(); $month=$today['mon']; $mday=$today['mday']; $year=$today['year']; $hours= "00"; $minutes="00"; $seconds="00"; $today=$year.'-'.$month.'-'.$mday.' '.$hours.':'.$minutes.':'.$seconds; $date=$today; $link_base="https://www.jobbuilding.be/"; echo "".$link_base."
"."\n"; $industry_arr['1.'] = "Ontwikkeling & Expansie"; $industry_arr['2.'] = "Beheer & Management"; $industry_arr['3.'] = "Deskundigen"; $industry_arr['4.'] = "Bouw & Techniek"; $industry_arr['5.'] = "Verhuur & Verkoop"; $industry_arr['6.'] = "Financieel & Verzekeringen"; $industry_arr['7.'] = "Ontwerp & Creatief"; $industry_arr['8.'] = "Juridisch"; $industry_arr['9.'] = "Nevenfuncties"; $industry_arr['10.'] = "Administratief"; $industry_arr['11.'] = "Consultancy"; $industry_arr['12.'] = "Franchising & Filiaalhouders"; $industry_arr['13.'] = "Directie & Topmanagement"; $industry_arr['14.'] = "Overheidsdiensten"; $industry_arr['374.'] = "Opleiding & Onderzoek"; $industry_arr['381.'] = "Andere functies"; $snoopy=new Snoopy; $snoopy->agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"; $snoopy->referer="http://www.google.com/"; $snoopy->rawheaders["Pragma"]="no-cache"; $snoopy->maxredirs=2; $snoopy->offsiteok=false; $snoopy->expandlinks=false; $snoopy->passcookies=true; $snoopy->set_submit_normal(); $snoopy->setcookies(); if(!sizeof($industry_arr)) $industry_arr=array(''); foreach ($industry_arr as $cat_link=>$industry) { $already_submitted=0; $next_page_exists=true; $page_nr=1; while ($next_page_exists) { $link_base_while=$link_base."Search.aspx?&p=3.&q=&page=".($page_nr-1); echo "".$link_base_while."".($industry ? "\n"."
".$industry." Jobs" : "")."
"."\n"; if(!$local_debug) { $snoopy->fetch($link_base_while); $htmlsource=$snoopy->results; } else { //$htmlsource = getSource ('http://computer4.server.intranet/clients/other/gotomyjob.com/cron/_tmp/www.nationalevacaturebank.nl_vacatures.html'); } if (!eregi('type="button" name="Laatste"',$htmlsource)) { $next_page_exists=false; } echo $htmlsource;exit; ExtractAndDelete($htmlsource,'Volgende pagina','<'); do { echo "
"; /* $date_extracted = ExtractAndDelete($htmlsource,'
','<'); if($link!="-1" && $date_extracted!="-1") { $date_exploded=explode("/",trim($date_extracted)); $date=$date_exploded[2]."-".(strlen($date_exploded[1])==1?"0":"").$date_exploded[1]."-".(strlen($date_exploded[0])==1?"0":"").$date_exploded[0]; if (strtotime($date) <= strtotime(date('Y-m-d', mktime(date('H'),0,0,date('m'),date('d')-$delete_days,date('Y'))))) { echo "
Expired Jobs
"; continue; } } // */ $link=ExtractAndDelete($htmlsource,'="ab" href=\'','\''); $title=ExtractAndDelete($htmlsource,'>','<'); $title=preg_replace("/^\((.*)\)/","",$title); $city=ucwords(strtolower(ExtractAndDelete($htmlsource,'','<'))); $link=$link_base.$link; echo "Details Page: ".$link."
"."\n"; //$industry $occupation=$title; if(substr($link,-2)=="-1") $link="-1"; if($link!="-1") { //* $snoopy->fetch($link); $htmlsource1=$snoopy->results; ExtractAndDelete($htmlsource1,'Functieomschrijving',''); $description=RemoveAllTrash(ExtractAndDelete($htmlsource1,'','')); // */ } $thetime="fulltime"; $hhh=strtolower($htmlsource1); if(strpos($hhh,"tijdelijk")>0)$thetime="parttime"; else if(strpos($hhh,"parttime")>0)$thetime="parttime"; else if(strpos($hhh,"part time")>0)$thetime="parttime"; if(strcmp($link,"-1")!=0){ //$link=$link_base.$link; echo "\n"."
--".$counter++."--"; $already_submitted+=AddToDatabase($title,$link,$description,$city,$date,$source,$occupation,$industry,$company,$thetime,$thelogo); } if($already_submitted>=3) { echo "\n"."
Found 3 entries already submitted in the database. Exiting ...
"."\n"; break 2; } //###debug-start### after the last AddToDatabase, but ouside the condition if(strcmp($link,"-1")!=0) { if($title=="-1" | $title=="") $bad_title[$link_base.$industry_link]++; if($description=="-1" | $description=="") $bad_description[$link_base.$industry_link]++; if($city=="-1" | $city=="") $bad_city[$link_base.$industry_link]++; if($occupation=="-1" | $occupation=="") $bad_occupation[$link_base.$industry_link]++; if($industry=="-1" | $industry=="") $bad_industry[$link_base.$industry_link]++; if($company=="-1" | $company=="") $bad_company[$link_base.$industry_link]++; if ($testmode && (($counter>5 && $testmode==1) | ($counter>$testmode && $testmode!=1))) { echo "\n"."
Stopped at ".($counter)." job. Exiting..."; cron_debug_check_errors(); exit; } } else { $bad_link[$link_base.$industry_link]++; } //###debug-end### ob_flush(); flush(); if(substr($link,-2)=="-1") echo "\n"."
--- BAD LINK ---------------------------------------------------------------------------
"."\n"; } while (strcmp($link,"-1")); echo "############################################################################
"."\n"."End of Page: ".($page_nr)."\n"."
############################################################################

"."\n"; $page_nr+=1; } } echo "\n"."
------------------------------------------"."\n"."
Finishing the process!!!
"."\n"; //###debug-start### bottom of page function cron_debug_check_errors() { global $bad_link, $bad_title, $bad_description, $bad_city, $bad_occupation, $bad_industry, $bad_company; echo "\n"."
Debug messages:
"."\n"; if(sizeof($bad_link)) { foreach ($bad_link as $key=>$value) { echo "\n"."
Bad links: Error in URL: ".$key." - nr. of bad links: ".$value.""; } } if(sizeof($bad_title)) { foreach ($bad_title as $key=>$value) { echo "\n"."
Bad titles: Error in URL: ".$key." - nr. of bad titles: ".$value.""; } } if(sizeof($bad_description)) { foreach ($bad_description as $key=>$value) { echo "\n"."
Bad descriptions: Error in URL: ".$key." - nr. of bad descriptions: ".$value.""; } } if(sizeof($bad_city)) { foreach ($bad_city as $key=>$value) { echo "\n"."
Bad cities:Error in URL: ".$key." - nr. of bad cities: ".$value.""; } } if(sizeof($bad_occupation)) { foreach ($bad_occupation as $key=>$value) { echo "\n"."
Bad occupations: Error in URL: ".$key." - nr. of bad occupations: ".$value.""; } } if(sizeof($bad_industry)) { foreach ($bad_industry as $key=>$value) { echo "\n"."
Bad industries: Error in URL: ".$key." - nr. of bad industries: ".$value.""; } } if(sizeof($bad_company)) { foreach ($bad_company as $key=>$value) { echo "\n"."
Bad companies: Error in URL: ".$key." - nr. of bad companies: ".$value.""; } } } echo "\n\n"."

"; cron_debug_check_errors(); /* // generate the necessary code for this cron file: select the code below then press CTRL+[-] then use it print("\n------------------------------------------------------------------------------------------------------------------------") local job_site='' for m in editor:match("[$]source[ ]*=[ ]*.*", SCFIND_REGEXP) do job_site=string.gsub(m.text,"(.*)=\"(.*)\"(.*)","%2") end print("INSERT INTO `prio` ( `id` , `source1` , `priority` ) VALUES (NULL , '"..job_site.."', '0');") print("-> upload cron_bx_xxx.php file"); print("add to CRON_STAT.PHP : $job_sites['"..job_site.."']=\""..job_site.."\";"); print("11 23 * * * /usr/bin/php /var/www/vhosts/gotomyjob.com/httpdocs/"..filename().." >/dev/null"); print("------------------------------------------------------------------------------------------------------------------------") */ //###debug-end### ?>