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 ); |
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 ... "; |
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..... |