we have domain search script in perl this script call from php using exec() command .when call the perl script from php with some domain name and userid then perl script crawl the domain detail and insert into mysql table .table names are domain,host so its working .problem is when 2 user search same time perl script insert insert some data of 1 user to 2 user detail viceversa here my code
use warnings; use Getopt::Std; use URI; use LWP::UserAgent; use HTTP::Request; use Yahoo::Search; use Net::Whois::Raw; use Net::DNS; use HTML::LinkExtractor; use Try::Tiny; use XML::Simple; use XML::DOM; use XML::XPath; use XML::XPath::XMLParser; use URI::Escape; use MIME::Base64; use Digest::HMAC_SHA1 qw(hmac_sha1); use Data::Dumper; use Siteminer; use CGI; use threads; # # Global Variables # # my %DEBUG = ( "addDomain" => 1, "getWhois" => 1, "domainOwner" => 1, "netcraftMine" => 1, "yahooMine" => 1, "intTLDSearch" => 1, "alexaRank" => 1, "hostMine" => 1, "yahooLinks" => 1, "bingMine" => 1, "pageRank" => 1, "pullData" => 1, "addHostname" => 1, ); # # Amazon AWIS Account Keys # my $AWIS_ACCESS_KEY_ID = "XXXXXXXXXXXXXXXXXXx"; my $AWIS_SECRET_ACCESS_KEY = "XXXXXXXXXXXXXXXXXXx"; my $AWIS_SERVICE_ENDPOINT = "XXXXXXXXXXXXXXXXXXx"; my $AWIS_ACTION = "XXXXXXXXXXXXXXXXXXx"; # # command line arguements # #chomp($name = param("uid")); my %opts = (); getopts('hvd:', \%opts) || usage(); my $user_id= $ARGV[0]; my $owner_email = ""; $Net::Whois::Raw::OMIT_MSG = 1; # # Main # main(); #my $thr1=threads->create(\&main); sub main { # # Check arguments # usage() if ($opts{h} || ! $opts{d}); # # check if domain name is valid # if (! domainNameIsValid(DOMAIN=>$opts{d})) { print STDERR "\nError: Domain Name invalid (example: foo.com)\ +n"; usage(); } $owner_email = addDomain(DOMAIN=>$opts{d}, ORIGIN=>$opts{d}) || "" +; netcraftMine(DOMAIN=>$opts{d}); # # Search Yahoo (Deprecated) # #yahooMine(DOMAIN=>$opts{d}); while(my @hostnames = Siteminer::Hosts->search('done' => '0')) { hostMine(HOSTS=>\@hostnames, ORIGIN=>$opts{d}); bingMine(HOSTS=>\@hostnames, ORIGIN=>$opts{d}); } while(my @domains = Siteminer::Domains->search('done' => '0', 'own +er' => $opts{d})) { foreach my $obj (@domains) { my $domain = $obj->domain; print "DO: $domain\n"; netcraftMine(DOMAIN=>$domain); # # Yahoo (Deprecated) # #yahooMine(DOMAIN=>$domain); while(my @hostnames = Siteminer::Hosts->search('done' => ' +0')) { hostMine(HOSTS=>\@hostnames, ORIGIN=>$opts{d}); bingMine(HOSTS=>\@hostnames, ORIGIN=>$opts{d}); } $obj->done(1); $obj->update; } } }

siteminer.pm

package Siteminer::DBI; use base 'Class::DBI'; # Setup connection to database Siteminer::DBI->connection('dbi:mysql:database', 'username', 'password +'); package Siteminer::Hosts; use base 'Siteminer::DBI'; __PACKAGE__->table('hosts'); __PACKAGE__->columns( All => ( "id", "hostname", "ipaddress", "webcode", "webbanner", "webtitle", "sslcode", "sslbanner", "ssltitle", "done", "redirect", "origin", "yweblinks", "alexarank", "pr", "login", "loginuserid", ) ); package Siteminer::Domains; use base 'Siteminer::DBI'; __PACKAGE__->table('domains'); __PACKAGE__->columns( All => ( "id", "domain", "email", "whois", "server", "origin", "owner", "done", "loginuserid", ) );

In reply to how can Multiple Insert in Perl to mysql with php by dartsuresh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.