AddPost( $url, $title, $description, $tags ); if (!$bSuccess) { echo "failure on post"; exit; } } return true; } function process_line($ln) { $description = ''; preg_match('/ \((.*)\)/', $ln, $matches); if (!empty($matches)) { $description = $matches[1]; $ln = preg_replace('/ \(.*\)/', '', $ln); } $tags = split(" ", $ln); if (count($tags) > 25) { echo "Suspicious number of tags!"; exit; } // first "tag" is in fact a URL $url = array_shift($tags); $title = get_title_from_full_url($url); if (empty($title)) { echo "GetTitle failed for $url!"; exit; } return array( // in the right order for the delicious posting $url, $title, $description, $tags ); } function get_title_from_full_url($link) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $link); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $contents = curl_exec($ch); curl_close($ch); $contents = preg_replace("/(\n|\r)/", '', $contents); if (preg_match('/