A look at this weeks greatest links via my del.icio.us

"; // End of important Variables collectDelDays($szDeliciousUsername, $szDeliciousPassword, $nDays); $szHTML = "{$szPostIntroduction}"; $szHTML = str_replace("&", "&", $szHTML); $szHTML = str_replace("<", "<", $szHTML); $szEntry = " metaWeblog.newPost 1 {$szXMLRPCUsername} {$szXMLRPCPassword} title {$szPostTitle} mt_text_more description {$szHTML} mt_allow_pings 1 mt_keywords delicious mt_convert_breaks 0 mt_excerpt mt_allow_comments 1 1 "; $szRequest = "POST {$szXMLRPCPath} HTTP/1.0\r\n" . "Content-type: text/xml\r\n" . "Content-length: " . strlen($szEntry) . "\r\n" . "UserAgent: scissordesign del.icio.us xmlrpc post on demand\r\n" . "Host: {$szBlogHost}\r\n" . "Connection: Close\r\n\r\n" . $szEntry; $fp = fsockopen($szBlogHost, 80); if(!$fp) { echo "bad file"; } else { fputs($fp, $szRequest); $szSent = str_replace("<", "<", $szRequest); $szSent = str_replace(">", ">", $szSent); //echo "

SENT

{$szSent}
"; //Enable this line in order to see what is sent, careful it will show your password to anyone who inadvertantly runs this php page. echo "

REPLY

";
		
		while (!feof($fp)) {
			$szReply .= fgets($fp, 1024);
		}
		$szReply = str_replace("<", "<", $szReply);
		$szReply = str_replace(">", ">", $szReply);
		echo $szReply;
		echo "
"; fclose($fp); } echo "

FINISHED

"; } function startElement($parser, $name, $attrs) { if($name == "POST") { $GLOBALS["HTML"] .= "
  • "; $GLOBALS["HTML"] .= "{$attrs["DESCRIPTION"]}"; $GLOBALS["HTML"] .= "
    "; $GLOBALS["HTML"] .= "{$attrs["EXTENDED"]}"; $GLOBALS["HTML"] .= "
  • "; } } function endElement($parser, $name) { } function parseDel($szDeliciousURL) { $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); if (!($fp = fopen($szDeliciousURL, "r"))) { die("could not open XML input"); } while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } } xml_parser_free($xml_parser); } function collectDelDays($szUsername, $szPassword, $nDays) { $nDate = time(); $GLOBALS["HTML"] = ""; for($i = 0; $i < $nDays; $i++) { $szURL = "http://{$szUsername}:{$szPassword}@del.icio.us/api/posts/get?dt=" . date("Y-m-d", $nDate); echo $szURL; parseDel($szURL); $nDate -= 86400; } } ?>