Error While using Curl function in domain search

Discussion in 'PHP' started by girishbm.gowda, Feb 16, 2010.

  1. #1
    Hi

    i am using the following curl function in my php script for domain search , i am getting the following error only when i give "girish" is given in a domain name

    Error :- This request takes too long to process, it is timed out by the server

    http://pbminfotech.com/girish/domain/


    //--My PHP Script--//

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">

    <html>

    <title>PBMInfotech-Domain Search</title>

    <link rel="stylesheet" href="css/style.css" type="text/css" />

    <body>

    <form method="POST" action="">

    <table>

    <tr><td>

    Domain name: <input type="text" name="domain"></td></tr>

    <tr><td>

    <input type="checkbox" name="tld[]" checked value=".com"/>.com

    <input type="checkbox" name="tld[]" value=".org"/>.org

    <input type="checkbox" name="tld[]" value=".net"/>.net

    <input type="checkbox" name="tld[]" value=".info"/>.info

    <input type="checkbox" name="tld[]" value=".mobi"/>.mobi

    <input type="checkbox" name="tld[]" value=".eu"/>.eu

    </td></tr>

    <tr>

    <td>

    <input type="checkbox" name="tld[]" value=".me"/>.me

    <input type="checkbox" name="tld[]" value=".in"/>.in

    </td>

    </tr>

    <tr><td><input type="submit" name="submitBtn" value="Check domain"/></td></tr>

    </table>

    </form>

    </body>

    </html>

    <?php

    if(isset($_POST['submitBtn'])){

    $dname = $_POST['domain'];

    echo '<div class="name">The Following Options Are Avaliable For Your Domain :"<span class=domname>'.$dname.'</span>"</div><br/>';

    }

    function domain_check($domain, $dm) {

    $val12 = $dm;

    $data = $domain.$dm;

    // Create a curl handle to a non-existing location

    $ch = curl_init($data);

    //echo $data;

    // Execute

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    curl_exec($ch);



    // Check if any error occured

    if(curl_errno($ch))

    {

    //echo $domain;

    //echo '<input type=checkbox>'.'&nbsp;'.$domain;

    echo '<div class="bgimg_avaliable"><input type=checkbox><br/>'.$val12.'</div>';

    //echo '<table><tr><td class="bgimg_avaliable"><input type=checkbox align=absmiddle><br/>'.$val12.'</td></tr></table>';

    } else {

    //echo $domain;

    // echo 'Taken'.'&nbsp;'.$domain;

    echo '<div class="bgimg_taken">Taken<br/>'.$val12.'</div>';

    //echo '<table><tr><td class="bgimg_taken">Taken<br/>'.$val12.'</td></tr></table>';

    }



    // Close handle

    curl_close($ch);

    }

    // Usage:

    if(isset($_POST['domain'])) {

    $arr = $_POST['tld'];

    $v1 =count($arr);

    if(($v1 =='0') || ($v1 >= '1')){

    $arr =array('.com','.org','.net','.info','.mobi','.eu','.me','.in', '.biz', '.co.in');

    } //to check in all domain extensions

    foreach($arr as $var => $val) {

    echo domain_check($_POST['domain'],$val);

    }

    }

    ?>



    //--End of the script--//

    i want to know where i am wrong and how can i fix that bug.

    Thanks in advance.
     
    girishbm.gowda, Feb 16, 2010 IP
  2. Silver89

    Silver89 Notable Member

    Messages:
    2,243
    Likes Received:
    72
    Best Answers:
    0
    Trophy Points:
    205
    #2
    Where's the location of the script so I can see the error?
     
    Silver89, Feb 17, 2010 IP
  3. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #3
    and post in php tags.
     
    danx10, Feb 17, 2010 IP
  4. girishbm.gowda

    girishbm.gowda Guest

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    girishbm.gowda, Feb 17, 2010 IP
  5. uworks

    uworks Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I made a curl command for your query. Just integrate into your code yourself. Here is the code:
    
    $domain="google";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://pbminfotech.com/girish/domain/index.php");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_exec($ch);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "domain=$domain&tld%5B%5D=.com&tld%5B%5D=.org&tld%5B%5D=.net&tld%5B%5D=.info&tld%5B%5D=.mobi&tld%5B%5D=.eu&tld%5B%5D=.me&tld%5B%5D=.in&submitBtn=Check+domain");
    $code = curl_exec($ch);
    curl_close($ch);
    echo <<<_HTML_
    <style type="text/css">
    /* CSS Document */
    .bgimg_taken{
    background:url('http://pbminfotech.com/girish/domain/images/taken.jpg');
    background-repeat:no-repeat;
    height:34px;
    width:42px;
    font-family:Verdana, Arial, Helvetica, sans-serif;
    font-size:10px;
    text-align:center;
    color:#666666;
    padding-top:8px;
    float:left;
    }
    
    .bgimg_avaliable{
    background:url('http://pbminfotech.com/girish/domain/images/avaliable.jpg');
    background-repeat:no-repeat;
    height:34px;
    width:42px;
    font-family:Verdana, Arial, Helvetica, sans-serif;
    font-size:10px;
    text-align:center;
    color:#666666;
    padding-top:8px;
    float:left;
    }
    .name{
    font-family:Verdana, Arial, Helvetica, sans-serif;
    font-size:12px;
    font-weight:bold;
    color:#008000;
    border-bottom:1px dashed;
    border-bottom-color:#CCCCCC;
    border-left:1px dashed;
    border-left-color:#CCCCCC;
    border-top:1px dashed;
    border-top-color:#CCCCCC;
    border-right:1px dashed;
    border-right-color:#CCCCCC;
    width:500px;
    }
    
    .domname{
    font-family:Verdana, Arial, Helvetica, sans-serif;
    font-size:14px;
    font-weight:bold;
    color:#0080FF;
    }
    </style>
    _HTML_;
    $explode=explode('<div class="name">',$code);
    echo '<div class="name">'.$explode[1];
    PHP:
     
    uworks, Feb 18, 2010 IP
  6. girishbm.gowda

    girishbm.gowda Guest

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    can u tell me where should i implement the above code in my php script please.
     
    girishbm.gowda, Feb 18, 2010 IP
  7. uworks

    uworks Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I cant understand your code. It has a quite bad quality. Please try yourself.
     
    uworks, Feb 18, 2010 IP
  8. girishbm.gowda

    girishbm.gowda Guest

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    shall i mail u mt php pages
     
    girishbm.gowda, Feb 18, 2010 IP
  9. girishbm.gowda

    girishbm.gowda Guest

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Hi,

    can i know is their any php script r methods to add domain details to my website.

    I mean when user wants to know the details about a particular domain they will type in a text box, so that we need to provide the details like in whois server.

    for example have a look of the following example : - http://www.networksolutions.com/whois/index.jsp

    Please provide me some information which is related to this...

    thanks in advance,

    Regard's
    Girish
     
    girishbm.gowda, Feb 18, 2010 IP
  10. uworks

    uworks Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    This is called as whois.

    Search google for whois script you may get several ajax/php scripts.

    Thank you
     
    uworks, Feb 19, 2010 IP