The .TEL Community on the .TEL Domain Forum!

Welcome to the Tel.community.

You are invited to participate in the growing .tel
community!

To take full advantage of everything offered by
our forum, please log in if you are already a
member or join our community if you're not yet.

The registration at TelTalk.org is free and easy!

Thank you for participation!

Join the forum, it's quick and easy

The .TEL Community on the .TEL Domain Forum!

Welcome to the Tel.community.

You are invited to participate in the growing .tel
community!

To take full advantage of everything offered by
our forum, please log in if you are already a
member or join our community if you're not yet.

The registration at TelTalk.org is free and easy!

Thank you for participation!

The .TEL Community on the .TEL Domain Forum!

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The .TEL Community on the .TEL Domain Forum!

Welcome to the objective forum for .tel domains! Read it first when anything is happening with .tel!

Please join the LIVE CHAT for all REGISTERED members at the bottom of our forum!

    script to pull telstats for multiple tels

    Telnic
    Telnic
    High-Flyer
    High-Flyer


    Join date : 2014-12-30
    Posts : 2903 Points : 11325
    Reputation : 0
    Warning level : 100 %

    script to pull telstats for multiple tels Empty script to pull telstats for multiple tels

    Post by Telnic 2015-01-03, 4:13 am

    dottel.net11-09-2009 03:49 PM




    script to pull telstats for multiple tels
     
    hi - we're trying to pull multiple stats for our various tels via a simple script but keep getting a 417 Expectation Failed response. Is there anything specific we need to do over and above the usual curl request?

    Here's the simple code:

    $action = 'https://telstats.nic.tel/log.pl';
    $params = array (
    'u' => '___', 
    'p' => '___', 
    'a' => '__', 
    'd' => '___', 
    's' => '2009/10/09', 
    'e' => '2009/11/09 23:59:59'
    );

    $options = array( 
    CURLOPT_HEADER => false, 
    CURLOPT_FOLLOWLOCATION => true, 
    CURLOPT_AUTOREFERER => true, 
    CURLOPT_MAXREDIRS => 2, 
    CURLOPT_CONNECTTIMEOUT => 20, 
    CURLOPT_TIMEOUT => 120, 
    CURLOPT_URL => $action,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_VERBOSE => 1,
    CURLOPT_SSL_VERIFYPEER => false, CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $params,
    ); 

    $ch = curl_init(); 
    curl_setopt_array( $ch, $options ); 
    $response = curl_getinfo( $ch ); 
    curl_close( $ch );

    Mark Kolb (Kprobe)11-09-2009 04:40 PM




    I have my own script at www.mytel.me/telstats.php which dumps the data to a local file.
    I use the following curl code ...

    $dd=$_POST['d'];
    echo "Contacting Telnic $dd ...

    ";
    // use curl to post, then grab contents
    $errno=0;
    $ch = curl_init('https://telstats.nic.tel/log.pl?dummy=x');
    curl_setopt($ch, CURLOPT_POST ,1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
    curl_setopt($ch, CURLOPT_HEADER ,0); // DO NOT RETURN HTTP HEADERS
    curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1); // RETURN THE CONTENTS OF THE CALL
    curl_setopt($ch, CURLOPT_POSTFIELDS ,"&u=$u&p=$p&d=$d&a=$a&s=$s&e=$e");
    $site = curl_exec($ch);


    dottel.net11-09-2009 05:11 PM




    thanks mark. oddly enough even setting params to match yours using the method of initialising everything together via an options array still fails.

    your way works - don't understand why though, as technically both should work.....

      Current date/time is 2024-05-06, 10:19 am