当前位置: 首页 > news >正文

asp网站抓取百度指数查询

asp网站抓取,百度指数查询,网站建设有哪三部,网站服务器 优帮云最近搞图片上传#xff0c;折腾了一个星期终于做出来了#xff0c;网上搜出来的方法几乎都是好几年前的#xff0c;试了好多都不能用#xff0c;此次把代码公布出来供大家参考。注#xff1a;部分代码是后台写的#xff0c;此方法没用到第三方库。1.图片保存到本地同时上…最近搞图片上传折腾了一个星期终于做出来了网上搜出来的方法几乎都是好几年前的试了好多都不能用此次把代码公布出来供大家参考。注部分代码是后台写的此方法没用到第三方库。1.图片保存到本地同时上传服务器(void)saveImage:(UIImage *)image {//NSLog(“保存头像”);//[userPhotoButton setImage:image forState:UIControlStateNormal];BOOL success;NSFileManager *fileManager [NSFileManager defaultManager];NSError *error;NSArray *paths NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);NSString *documentsDirectory [paths objectAtIndex:0];NSString *imageFilePath [documentsDirectory stringByAppendingPathComponent:“selfPhoto.jpg”];NSLog(“imageFile-%”,imageFilePath);success [fileManager fileExistsAtPath:imageFilePath];if(success) {success [fileManager removeItemAtPath:imageFilePath error:error];}//UIImagesmallImage[self scaleFromImage:image toSize:CGSizeMake(80.0f, 80.0f)];//将图片尺寸改为8080UIImage *smallImage [self thumbnailWithImageWithoutScale:image size:CGSizeMake(93, 93)];[UIImageJPEGRepresentation(smallImage, 1.0f) writeToFile:imageFilePath atomically:YES];//写入文件UIImage *selfPhoto [UIImage imageWithContentsOfFile:imageFilePath];//读取图片文件self.img.image selfPhoto;NSLog(“selfPhoto %”,selfPhoto);NSURL * url [NSURL URLWithString:http://blog.sina.com.cn/tmyij];NSData *imageData UIImageJPEGRepresentation(selfPhoto,1.0f);[self uploadFileWithURL:url data:imageData];}2.下面俩个方法都是设置请求参数static NSString *boundaryStr –;static NSStringrandomIDStr ****;static NSString *uploadID “file”;(NSString *)topStringWithMimeType:(NSString *)mimeType uploadFile:(NSString *)uploadFile{NSMutableString *strM [NSMutableString string];[strM appendFormat:%%\r\n, boundaryStr, randomIDStr];[strM appendFormat:“Content-Disposition: form-data; name”%; filename%\r\n, uploadID, uploadFile];[strM appendFormat:“Content-Type: %\r\n”, mimeType];[strM appendFormat:\r\n];NSLog(%, strM);return [strM copy];}(NSString *)bottomString{NSMutableString *strM [NSMutableString string];[strM appendFormat:%%\r\n, boundaryStr, randomIDStr];[strM appendString:“Content-Disposition:form-data; name“number”\r\n”];[strM appendFormat:\r\n];[strM appendString:“1234566788”];//上传的参数parameter[strM appendFormat:\r\n];NSLog(%, strM);return [strM copy];}3.图片上传服务器(void)uploadFileWithURL:(NSURL *)url data:(NSData *)data{NSString *topStr [self topStringWithMimeType:“application/img” uploadFile:“myHead.jpg”];NSString *bottomStr [self bottomString];NSMutableData *dataM [NSMutableData data];[dataM appendData:[bottomStr dataUsingEncoding:NSUTF8StringEncoding]];[dataM appendData:[topStr dataUsingEncoding:NSUTF8StringEncoding]];[dataM appendData:data];[dataM appendData:[\r\n dataUsingEncoding:NSUTF8StringEncoding]];NSString * s [NSString stringWithFormat:%%%\r\n,boundaryStr, randomIDStr, boundaryStr];[dataM appendData:[str22 dataUsingEncoding:NSUTF8StringEncoding]];NSLog(%%%,topStr,data,bottomStr);// 1. RequestNSMutableURLRequest *request [NSMutableURLRequest requestWithURL:url cachePolicy:0 timeoutInterval:20.0f];request.HTTPBody dataM;request.HTTPMethod “POST”;NSString *strLength [NSString stringWithFormat:%ld, (long)dataM.length];[request setValue:strLength forHTTPHeaderField:“Content-Length”];NSString *strContentType [NSString stringWithFormat:“multipart/form-data;boundary%”, randomIDStr];[request setValue:strContentType forHTTPHeaderField:“Content-Type”];[NSURLConnection sendAsynchronousRequest:requestqueue:[[NSOperationQueue alloc] init] completionHandler:^(NSURLResponse*response, NSData *data, NSError *connectionError) {NSString *result [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];NSLog(%, result);}];}
http://www.yutouwan.com/news/68166/

相关文章:

  • 做云购网站株洲房地产信息网
  • 教学网站建设 效益安卓优化大师官方版本下载
  • seo网站排名优化公司宁波seo推广公司排名
  • 网站的成本国家企业公示系统
  • 中核华泰建设有限公司网站槐荫区网站建设
  • 网站开发 定制 多少 钱电子政务与网站建设的经验
  • 中国建设银行贷款官网站网站开发长期合作
  • wordpress地址和站点地址错html5新手做的网页
  • 十大购物网站排名相关文章wordpress
  • 大淘客网站上的推广怎么做wdcp搭建网站教程
  • 网站做用户记录网站优化公司服务
  • 湖北建设执业资格注册中心网站做旅游的网站有哪些
  • 网站开发研究背景傻瓜式建设网站的软件
  • 自助游网站开发分析报告做视频网站要什么软件
  • 做二手房怎找房源网站nginx 防御 wordpress 攻击
  • wordpress怎么开启多站点电商公司的网上设计
  • 手机适配网站百度推广投诉电话
  • 烟台中企动力提供网站建设宜春个人网站建设
  • 莆田网站制作企业面向搜索引擎网站建设
  • 耐克1网站建设的总体目标网站备案 视频
  • 学网站建设与管理有用吗营销型网站建设专家
  • 网站关键词排名seo网站服务器租用报价
  • 建立网站的原因百度ai营销中国行
  • python做网站好吗怎么注册自媒体号挣钱
  • 自己创建网站403wordpress插件授权破解版
  • 深圳网站建设机构长春网站建设方案报价
  • 北京怀柔网站制作如何制作小程序赚钱
  • 做问卷用哪个网站长春市长春网站制作站优化
  • 网站怎么做会被收录企业网站模板下载需谨慎
  • 视频网站的建设目标wordpress 视频