这也是一个很奇葩的问题! 安装在本地的tomcat服务器,IE11里面只有用localhost可以访问,其余127.0.0.1和IPv4的地址都不行。查看tomcat绑定的端口,默认0.0.0.0和::1都是有的,但是通过localhost访问,查看建立的链接都是IPv6地址的,这就奇怪了,为什么明文指定的v4地址IE都不认呢?搞怪。后来google了一下,解决思路有三: 1.取消IE浏览器安全标 […]
分类: Other
other-各种其他与电脑相关的内容
php curl
看了一晚上的php基础,然后通过google的帮助用php curl成功调用了EMS的 Web Service接口,保存几个基本的function,或许以后还能用到:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# 截取字符串中两个指定标记之间的内容,如果截取的内容还有空格,可以使用ltrim()和rtrim()分别提出左右空格 function str_between($src, $mark1, $mark2) { $index1=strpos($src, $mark1); $index2=strpos($src, $mark2); if(!$index1 || !$index2) return "error"; else{ $index1 += strlen($mark1); return substr($src, $index1, $index2-$index1); } } # post数据,header根据自己的要post的网站要求填写,cookie设置也有好处;注释掉的内容是为了测试 function php_curl_post($url, $postdata) { $c_post=curl_init(); $header = array('Content-Type: text/plain; charset=UTF-8'); curl_setopt($c_post, CURLOPT_URL, $url); curl_setopt($c_post, CURLOPT_RETURNTRANSFER,true); curl_setopt($c_post, CURLOPT_POST,true); curl_setopt($c_post, CURLOPT_HTTPHEADER, $header); curl_setopt($c_post, CURLOPT_POSTFIELDS, $postdata); #curl_setopt($c_post, CURLOPT_BINARYTRANSFER, true); //set cookie curl_setopt($c_post, CURLOPT_COOKIEJAR, 'c:\www\cookie.txt'); curl_setopt($c_post, CURLOPT_COOKIEFILE, 'c:\www\cookie.txt'); // /* $std_out=fopen('c:\www\stdout.txt','a+'); $std_err=fopen('c:\www\stderr.txt','a+'); curl_setopt($c_post, CURLOPT_FILE, $std_out); curl_setopt($c_post, CURLOPT_STDERR, $std_err); curl_setopt($c_post, CURLOPT_VERBOSE,true); */ $result = curl_exec($c_post); curl_close($c_post); /* fclose($std_out); fclose($std_err); */ return $result; } # PUT数据,因为EMS特殊原因,将header和body分开保存到array中,便于提取header和body里面各自所需的内容 function php_curl_put($url, $putdata) { $c_put=curl_init(); $header = array('Content-Type: text/plain; charset=UTF-8'); curl_setopt($c_put, CURLOPT_URL, $url); curl_setopt($c_put, CURLOPT_RETURNTRANSFER,true); curl_setopt($c_put, CURLOPT_HTTPHEADER, $header); curl_setopt($c_put, CURLOPT_POSTFIELDS, $putdata); curl_setopt($c_put, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($c_put, CURLOPT_HEADER, true); //curl_setopt($c_put, CURLINFO_HEADER_OUT, true); //curl_setopt($c_put, CURLOPT_FOLLOWLOCATION, true); //set cookie curl_setopt($c_put, CURLOPT_COOKIEJAR, 'c:\www\cookie.txt'); curl_setopt($c_put, CURLOPT_COOKIEFILE, 'c:\www\cookie.txt'); // /* $std_out=fopen('c:\www\stdout.txt','a+'); $std_err=fopen('c:\www\stderr.txt','a+'); curl_setopt($c_put, CURLOPT_FILE, $std_out); curl_setopt($c_put, CURLOPT_STDERR, $std_err); curl_setopt($c_put, CURLOPT_VERBOSE,true); */ $result = curl_exec($c_put); $headerSize = curl_getinfo($c_put, CURLINFO_HEADER_SIZE); $header = substr($result, 0 , $headerSize); $body = substr($result, $headerSize); $ret = array('header'=>$header,'body'=>$body); curl_close($c_put); /* fclose($std_out); fclose($std_err); */ return $ret; } # GET数据,没有特殊的地方 function php_curl_get($url) { $c_get=curl_init(); $header = array('Content-Type: text/plain; charset=UTF-8'); curl_setopt($c_get, CURLOPT_URL, $url); #curl_setopt($c_get, CURLOPT_BINARYTRANSFER, true); curl_setopt($c_get, CURLOPT_RETURNTRANSFER,1); curl_setopt($c_get, CURLOPT_HTTPGET,true); //set cookie curl_setopt($c_get, CURLOPT_COOKIEJAR, 'c:\www\cookie.txt'); curl_setopt($c_get, CURLOPT_COOKIEFILE, 'c:\www\cookie.txt'); $result = curl_exec($c_get); curl_close($c_get); return $result; } |
这里没有delete的函数,根据资料,只需改动CURLOPT_CUSTOMREQUEST为"DELETE"一个地方就可以实现delete的功能,所以也没有再写下去 c […]
VirtualBox压缩vdi文件
随着虚拟机越建越多,越用体积越大,本地的磁盘已经快要捉襟见肘了,需要赶快清理一下。我们都知道,虚拟机磁盘在创建的时候可以选择动态(dynamically allocated)或者固定(fixed size)两种方式,动态方式可以初期占用较少物理磁盘空间,只要不超出最大配额,虚拟机用到多大就在物理磁盘上扩展多大,但是坏处就是容易在物理磁盘上产生碎片并最终影响性能,而且删除虚拟机上的文件释放空间后并不 […]
Dell Inspiron 14无线网卡掉线问题
预装的系统没发现有过这个问题,前段时间重装完win10 Pro之后,就在ssh树莓派的时候出现偶尔卡住的现象。那时也没太在意,直到今天拿出大菠萝的时候,服务器延迟竟然一直居高不下,实在让人恼火,新开通的8M歌华宽带,不应该这么不给力啊。ping百度试试,真的是有丢失的现象,郁闷。 本子预装的无线网卡是Intel(R) Dual Band Wireless-AC 3160,网上查发现这是个普遍的问题 […]
error 1603 when installing vs2010
昨天终于把撑了4年的xp professional换成了win7 professional x64,8G内存现在可以真正发挥作用了,接下来就是一堆堆的软件等待安装,好麻烦啊。这不在安装vs2010的时候就报错了嘛,看vs安装界面显示vc9 环境安装失败,检查日志显示“ MSI returned error code 1603”,网上看了一圈各种解决方法都很复杂,不靠谱--新安装的系统,哪有 […]
外链?推广?
今天搜索网站推广时发现tool.lusonson.com/seo这个地址,看起来非常的变态,只要输入网址一个单击,就能让近1800多个网站收录你的地址,真的有这么神奇吗?通过百度站长的外链分析,来对比一下是否有效果吧,先记录当天的百度外链分析情况: 好可怜,只有三个,等一两个星期,再看看情况吧...
一款制作U盘启动系统的工具
在网上找到的这款小工具,可以支持很多种系统从ISO到U盘启动的制作,推荐的原因主要是简单实用不罗嗦,工具下载地址如下: (http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/#button) 用法很简单,贴两张网站上给出的截图就足够了 :Ubuntu Live CD启动之后提示用户登录,这个时候可以检查 […]
U盘写保护恢复一例
最近用U盘测试Linux内核编译,不知道是VirtualBox出了问题还是频繁操作U盘导致我的2G盘变为只读的了,不管在windows还是Linux上都无法格式化,提示“U盘被写保护”或者“U disk只读”。可以肯定的是我的U盘没有写保护开关,不属于那种高大上的品种。那是什么原因?用fsck检查,确是存在坏块,但是由于read-only,所以无法修复,用 "hdparm -r0 /dev/sdc […]