草庐IT

data-files

全部标签

php - Behat:Goutte/Guzzle 通过 cURL "Warning: curl_setopt_array(): 3607 is not a valid File-Handle resource"下载文件

使用Behat测试一些涉及下载文件的行为。使用Goutte和Guzzle拦截文件下载,以便我可以在另一步骤中与其进行交互。//Wheretoputthefile$tmpFile='download.zip';$handle=fopen($tmpFile,'w');$goutteDriver=$this->getSession()->getDriver();$goutteClient=$goutteDriver->getClient();/**@var\Guzzle\Http\Client$guzzleClient*/$guzzleClient=$goutteClient->getCli

php - file_get_contents 不在本地主机上工作,但在在线网络服务器上工作

$json=file_get_contents('http://localhost/hts2015/data/functions.php?tag=FIND');$json=file_get_contents('http://www.hptsprofessional.tk/data/functions.php?tag=FIND');$jsonD=json_decode($json);$no=count($jsonD);2014年,我在我的本地主机上使用相同的代码通过file_get_contents()访问数据。它对我来说工作正常,它可以在本地主机上工作,也可以通过更改url在在线服务器

php - 代理后面的第 3 方 file_get_contents

我正在使用第3方库,它使用file_get_contents()来检索外部文档。因为我在代理后面,所以我得到了错误:file_get_contents(http://json-ld.org/contexts/person.jsonld):failedtoopenstream:Connectiontimedout我通过stream_context_create()使用代理设置测试了file_get_contents():$context=stream_context_create(['http'=>['proxy'=>'tcp://SERVERNAME:PORT','request_fu

javascript - $_FILES 使用 DropzoneJS 和 Symfony 1.4 返回空

我在网上搜索了几篇SO和博客文章,但找不到有用的东西。我正在尝试设置一个简单的HTML拖放表单,用户可以在其中通过DropzoneJS一次上传多个文件。HTML:'method="post"enctype="multipart/form-data"class="dropzone"id="basic_menu_dropzone">SUBMITJavascript:jQuery(document).ready(function($){Dropzone.autoDiscover=false;vardropzone=newDropzone('#basic_menu_dropzone',{par

php - 使用 curl put 上传文件 - multipart/form-data

我正在尝试通过curl-put方法上传文档。但是当我调用这个文件时,它只生成0字节文件而不是上传文件。我正在使用第三方的网络服务。这里缺少什么?标题中有什么吗?在文件名中我们需要传递文件名还是路径?PHP代码$data=json_encode($this->data);$file_url=$filepath;$f=array($filepath);$eol="\r\n";$BOUNDARY=md5(time());$BODY="";//initmycurlbody$BODY.='--'.$BOUNDARY.$eol;//startparamheader$BODY.='Content-D

php - 使用 file_get_contents() 进行抓取时强制使用桌面版网站

我正在使用FriendsOfPHP/Goutte包抓取网站。一切都很好。当用户将URL粘贴到输入中时,我正在为image、title等开放图形标签抓取网站。当用户从移动设备复制URL时会出现问题,该URL现在是移动URL,例如https://m.datpiff.com/tape/818948,并且该URL上没有开放图标签。当我访问相同的URL并将子域m替换为www时,例如https://www.datpiff.com/tape/818948从桌面,它将我重定向到:http://www.datpiff.com/Chance-The-Rapper-Jeremih-Merry-Christm

php - 我不明白 file_exists 和 scandir 是怎么回事

我正在帮助一位friend为他的一个脚本编写一个比较合理的缓存函数。它实际上使用9个不同的SQL查询来获取排行榜数据(其中一个非常费力)我想出了为它创建缓存的想法,开始时是这样的://Cachedirectory$cacheDir="/cache";//Pathtocachedirectory$cachePath="/var/www/html/test";//Bettersafethansorryif(!file_exists($cachePath.$cacheDir)){mkdir($cachePath.$cacheDir,0777,true);}//Cacherebuildswit

php - Imagecreatefromwebp() : WebP decode: fail to decode input data

我正在尝试使用imagecreatefromwebp()将webp文件转换为JPEG,但不幸的是,它向我发出警告:警告:imagecreatefromwebp():WebP解码:无法解码输入数据。这是我的代码$filename=dirname(__FILE__)."\\".$keyword."1.webp";//$keyword='xyz';$im=imagecreatefromwebp($filename);//Convertittoajpegfilewith100%qualityimagejpeg($im,'./example.jpeg',100);imagedestroy($im

php - simplexml_load_file() 错误

我对PHP比较陌生,对XML更是如此。我有一个脚本可以在我的本地主机上完美运行,但是当我尝试将它放在我的服务器上时,我收到以下消息:Warning:simplexml_load_file()[function.simplexml-load-file]:http://api.wefeelfine.org:8080/ShowFeelings?display=xml&feeling=happy&returnfields=imageid,feeling,sentence,posttime,postdate,posturl,gender,country,state,city,lat,lon&li

php: file_get_contents() 使用 CLI,但在服务器上调用时不起作用(在页面中)

我有点困惑。我正在使用bit.lyPHPAPI来缩短一些网址。这在本地主机上运行良好-但是当我在我的服务器上尝试它时(在Apache中运行的php),file_get_contents()返回一个空字符串。我检查了我的Apache日志,看不到Apache的任何警告/错误,所以我在CL上尝试了相同的命令(使用PHPCLI):>php-aphp>$long_url=some_url_encoded_string;php>echofile_get_contents($long_url);{"errorCode":0,"errorMessage":"","results":{"http://w