Home>Article>Backend Development> php curl_exec window ,linux

php curl_exec window ,linux

WBOY
WBOY Original
2016-06-23 13:25:59 1216browse

$ch = curl_init();
$header = "Accept-Charset: utf-8";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$tmpInfo = curl_exec($ch);
这个是我的代码,在本机上执行的时候没有问题,本机window 64位操作系统 ,但是本机通过服务器访问的时候提示未知错误号,未知错误,服务器是linux系统。


回复讨论(解决方案)

windows 和linux不一样的吧

windows 和linux不一样的吧


估计是linux curl的版本的问题,弄一下看下

是谁提示:未知错误号,未知错误???
显然不是 php

是哪里提示错误?

是谁提示:未知错误号,未知错误???
显然不是 php



执行$tmpInfo = curl_exec($ch);的时候提示错误

是哪里提示错误?



执行$tmpInfo = curl_exec($ch);的时候提示错误。然后我重新安装了一个curl7.44版本的也不行

php 不会给出这样的信息!
如果你说的属实,显然是你的目标地址返回的信息

Statement:
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