Leser: 1
|< 1 2 >| | 12 Einträge, 2 Seiten |
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
#-------------------------Use The LWP User Agent---------------
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
$ua->agent("myapp/0.1 ");
# -------------------------Check the Parameter for Adress import
if ($ARGV[0] == 1){
# Create a request
my $req = HTTP::Request->new(POST => 'http://127.0.0.1/import-client.php');
$req->content_type('application/x-www-form-urlencoded');
$req->header('Accept' => 'text/html');
#read the File with Adress data
open( PARTNER, $ARGV[1] ) || die "Error opening $ARGV[1] \n";
# get the information from File
while (<PARTNER>) {
chop;
# Split the content from file into $_ variable
($firma,$stand,$abt,$name) = split(/:/);
# Send as Request to PHP Script
$req->content("adress=1&firma=$firma&stand=$stand&abt=$abt&name=$name");
# Pass request to the user agent and get a response back
my $res = $ua->request($req);
if ($res->is_success) {
print $res->content;
}
}
# Close File
close(PARTNER);
}
perl Makefile.PL && make all test install
|< 1 2 >| | 12 Einträge, 2 Seiten |