'alexa', 'title' => t('Alexa'), 'callback' => 'alexa_page', 'access' => user_access('access alexa'), ); } return $items; } function alexa_page() { $edit = isset($_POST['edit']) ? $_POST['edit'] : ''; $form['button1'] = array( '#type' => 'textfield', '#title' => t('1st domain'), ); $form['button2'] = array( '#type' => 'textfield', '#title' => t('2nd domain'), ); $form['button3'] = array( '#type' => 'textfield', '#title' => t('3rd domain'), ); $form['button4'] = array( '#type' => 'textfield', '#title' => t('4th domain'), ); $form['button5'] = array( '#type' => 'textfield', '#title' => t('5th domain'), ); return drupal_get_form(alexa_form,$form,); } /** * Fetch the alexa info for a given ticker symbol from alexa! */ function alexa_fetch($form) { if (empty($form)) { return FALSE; } $host = 'http://traffic.alexa.com/graph?w=725&h=370&r=1m&y=r&a=1&z=1&u='; $url = $host . urlencode($form['button1']) .'&u='.urlencode($form['button2']).'&u='.urlencode($form['button3']).'&u='.urlencode($form['button4']).'&u='.urlencode($form['button5']); $contents = @file_get_contents($url); if ($contents) { if ($data = explode(',', str_replace('"', '', $contents))) { $data = array_map('trim', $data); return $data; } } return FALSE; }