#-------------------------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 () { 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); }