-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrawler.php
More file actions
108 lines (59 loc) · 2.92 KB
/
Copy pathcrawler.php
File metadata and controls
108 lines (59 loc) · 2.92 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
/*list category
Marketing----------
Accounting-------------
Art & Design-----advertising/design/public-relations/photography/fashion/
Business ------------
*/
/* category !!!! http://www.internships.com/computer-science?page=2*/
/*key word research http://www.internships.com/search/posts?Keywords=engineer%20&Location=newtork&page=2 */
ini_set('display_errors',1);
error_reporting(E_ALL);
$fp = fopen('computer.csv', 'w');
include('inc/simple_html_dom.php');
for($p = 1; $p < 550 ; $p++) {
$html = file_get_html('http://www.internships.com/computer-science?page='.$p); /*http://www.internships.com/computer-science?page=2*/
// Find all posts
foreach($html->find('div.internship-result-link-item') as $post) {
// initialisation
$item['internship-payment'] = 'Not paid ';
$item['College-Credit-Required'] = 'false' ;
$item['description'] = $post->find('div.description', 0)->plaintext ;
$item['company-name'] = $post->find('span.company-name', 0)->plaintext ;
$item['company-location'] = $post->find('span.internship-location', 0)->plaintext ;
$item['internship-dates'] = $post->find('div.internship-dates', 0)->plaintext ;
$item['internship-link'] = $post->find('a', 0)->href ;
$item['internship-title'] = $post->find('a', 0)->title;
foreach($post->find('img.tip') as $info) {
$tmp = $info->title;
switch($tmp)
{
case 'Part Time':
$item['internship-working-time'] = 'Part Time' ;
break;
case 'Paid Opportunity':
$item['internship-payment'] = 'Paid Opportunity' ;
break;
case 'Full Time':
$item['internship-working-time'] = 'Full Time' ;
break;
case 'College Credit Required':
$item['College-Credit-Required'] = 'true' ;
break;
default :
echo 'not known !!!!!!!!!!!!!!!!!!!';
break;
}
}
echo $item['company-name']."\n" ;
fputcsv($fp,$item,"^");
/*----------------------INSERT contry if not exist , get country ID , INSERT Job using country id ---------------------------------------------
INSERT INTO `cities` (`id`, `name`, `ascii_name`) VALUES
(1, 'London', 'LN')
INSERT INTO `jobs` (`id`, `type_id`, `category_id`, `title`, `description`, `company`, `city_id`, `url`, `apply`, `created_on`, `is_temp`, `is_active`, `views_count`, `auth`, `outside_location`, `poster_email`, `apply_online`, `spotlight`) VALUES
(1, 1, 1, 'web developer', 'We\\''re a startup searching for a cool web developer that masters following technologies:\r\n* php, mysql\r\n* javascript, dom, ajax\r\n* html, css\r\n\r\nPerson should also have a good sense of user behavior.\r\n\r\nExcellent payment! ;)', 'Foo Inc.', NULL, 'http://www.fooinc.com', '', '2008-08-20 09:35:29', 0, 1, 10, 'f1acd80152446f4cf8a0bb8242398be7', 'sss', 'jobs@fooinc.com', 1, 1) ;
*/
} // foreach post found
} // for page
fclose($fp);
?>