我有一个网站,允许人们取消订阅其他网站(邮件列表,或垃圾邮件等...)
我的网络应用程序允许客户和用户上传加密电子邮件列表以进行大规模取消订阅.
我有一张桌子:unsubs.该表有电子邮件和域名.
文件结构是这样的:
jhq232q3hq2yq3yuh2qyuqU/A$Ja324ju3a4jah34u3w$UQ"$Uq4u q34/hRYHSEa34uw34uQ"/YQ/$84?%JHHdfhdFJKAjaRJSErjsrjse W%$?p09-*Y+_)y8p7uYJgADGq2/TYQgSj1qR"3tQ"/gEHseruDUId
这是我的PHP:
function decrypt($line) {
// do my logic etc...
return $line;
}
function isEmail($email) {
if(preg_match("/^([a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9_-]+)+$/", $email)){
return true;
}
return false;
}
function checkEmail($email) {
// logic
return array('baddomain.com');
}
function emailExists($email) {
// my logic
return TRUE; // for example
}
$file = file_get_contents('sample.txt');
$lines= explode("\n", $file);
foreach($lines as $line) {
if(!empty($line)) {
$line = decrypt($line);
if(isEmail($line)) {
$services = checkEmail($line);
if(is_array($service)) {
foreach($services as $service) {
insertEmail($db, $service, $line); // …Run Code Online (Sandbox Code Playgroud) 我在为iPhone应用程序读取XML文件时出错.我的iPhone应用程序上有一个新功能,可以读取我的RSS源.一切看起来不错,但我有这个问题:
加载rss时出错.请检查您的Internet连接
这是我的代码:
- (BOOL) readRSS {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
[[NSURLCache sharedURLCache] setMemoryCapacity:0];
[[NSURLCache sharedURLCache] setDiskCapacity:0];
BOOL success = NO;
NSXMLParser *parser = nil;
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://rss.domain.com/%@.xml", self.currentPage]];
parser = [[NSXMLParser alloc] initWithContentsOfURL:url];
[parser setDelegate:self];
[parser setShouldProcessNamespaces:NO];
[parser setShouldReportNamespacePrefixes:NO];
[parser setShouldResolveExternalEntities:NO];
success = [parser parse];
[parser release];
[pool drain];
return success;
}
Run Code Online (Sandbox Code Playgroud)
然后我有这个代码:
- (void) cleartbl:(NSInteger)type {
[[[self rssParser] rssItems] removeAllObjects];
[_tableView reloadData];
if(type == 1) {
UIAlertView *alert = …Run Code Online (Sandbox Code Playgroud)