php 中关curl的奇葩有关问题.域名无法解析

WBOY
Release: 2016-06-13 12:15:00
Original
956 people have browsed it

php 中关curl的奇葩问题.域名无法解析

本帖最后由 qianghuay 于 2014-12-17 17:03:30 编辑 有个程序是要调用腾讯微博的开放接口,来获取用户的个人信息.
但是所有参数全部拼好之后,在本地机子上跑是没有问题,
但是在CentOS上跑就是获取获取到域名的ip地址:
第一张图为在本地机子上的curlinfo:

第二张图为在Centos服务器上跑的curlinfo:


看结果好像是php无法获取对应域名的Ip,于是我将域名与ip的映射写在hosts文件中,
但是还是不行.
奇怪的是,我在putty中可以ping能腾讯的接口域名的.
------解决思路----------------------
这个问题有点难,还是等高手吧
------解决思路----------------------
在本機/etc/hosts 指定一下域名,ip對應試試。
------解决思路----------------------
刚好前两天遇到过这个问题, curl获取不到https页面内容时, 可以使用fsockopen函数解决。

具体的就是使用下面这个函数:  
http://hi.baidu.com/slayerhover/item/2c85e1a210066b11020a4d49
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!