草庐IT

light-content

全部标签

如果 header 中有 'Content-Type: application/json',则不会创建 PHP 5.4.9 $_POST 超全局

我注意到在使用AWSElasticBeanstalkPHP5.4.9AMI时我的应用程序中发生了一个奇怪的错误。提交包含header'Content-Type:application/json'的GETAJAX请求时,$_POST超全局设置为null。如果我删除该header,它将按预期设置为空白array()这是预期的行为吗? 最佳答案 原来这是PECL的问题。当安装运行PHP5.4的PECLHTTP时,当为GET请求提供“Content-Type:application/json”header时,它会导致$_POST设置为nul

php - 使用自签名证书的 MAMP 中的 file_get_contents 失败

我使用file_get_contents()在我的站点中包含svg文件。通常这在http上工作正常,但我将此站点设置为在本地使用https。当我这样做时,出现此错误:Warning:file_get_contents():SSLoperationfailedwithcode1.OpenSSLErrormessages:error:14090086:SSLroutines:ssl3_get_server_certificate:certificateverifyfailedonline226Warning:file_get_contents():Failedtoenablecryptoo

php file_get_contents 向 Bugzilla 安装发送错误的内容类型

我正在创建一个脚本,该脚本应向bugzilla安装发送请求,以便登录用户并发布错误。我正在使用Google代码上提供的BugzillaPHPhttp://code.google.com/p/bugzillaphp/在我的本地服务器上一切正常,但在应该运行脚本的远程服务器上却不行。我从Bugzilla返回的错误是:Content-Typemustbe'text/xml,''multipart/*,''application/soap+xml,''or'application/dime'insteadof'application/x-www-form-urlencoded'这意味着我的脚本

php - 如何获取媒体 :content with SimpleXML

这个问题在这里已经有了答案:Reference-HowdoIhandleNamespaces(TagsandAttributeswithaColonintheirName)inSimpleXML?(2个答案)关闭2年前。我有一个XML提要,可以在新闻网站上获取有关塞浦路斯的新闻。我想使用新闻图片,当然还有新闻本身。这是一个xml示例RumlardanKKTCüniversitelerineambargoKıbrısRumyönetimi,KKTC'dekiüniversitelerleişbirliğiyapanülkelerineğitimkurumlarınaresmiyazıla

php - preg_replace file_get_contents 中不包含单词的所有链接

这个问题在这里已经有了答案:Regularexpressiontomatchalinethatdoesn'tcontainaword(33个答案)关闭9年前。我正在将一个页面读入一个变量,我想禁用地址中不包含单词“remedy”的所有链接。到目前为止,我的代码获取了所有链接,包括带有“补救措施”的链接。我做错了什么?$page=preg_replace('~(.*?)~i','$1',$page);--解决方案--$page=preg_replace('~(.*?)~i','$2',$page);

php - 如何防止 curl 或 file_get_contents 从服务器端访问我的页面

我在大约2小时内遇到了一个问题。谁能提供解决方案,我将不胜感激。http://mydowmin.com/userdatapage.php注意:我不想使用Curl函数从外部世界访问此页面如何避免这个脚本$ch=curl_init("http://mydowmin.com/userdatapage.php");curl_setopt($ch,CURLOPT_CERTINFO,1);curl_setopt($ch,CURLOPT_VERBOSE,1);curl_exec($ch)ordie;print_r(curl_getinfo($ch));http://mydomain.com/data

php - file_get_contents 的超时在 PHP 中不起作用

我创建了一个类来在PHP中包含一些HTTP方法。在这里,我有一个用于HTTPPOST的方法publicfunctionpost($content,$timeout=null){$timeInit=newDateTime();$this->method='POST';$header=array();$header['header']=null;$header['content']=is_array($content)?http_build_query($content):$content;$header['method']=$this->method;if($timeout!=NULL)

php - file_get_contents https 超时 1 分钟?

当通过https访问某些资源时,我遇到了PHP的file_get_contents挂起60秒的问题。我不确定这是客户端还是服务器端问题。在客户端在命令行上工作:$URL="https://example.com/some/path"$wget"$URL"-O/dev/null-q#takesafewmilliseconds$curl"$URL">/dev/null#takesafewmilliseconds$php-r'file_get_contents("'"$URL"'")'#takes61s!在服务器上为正确的SSLvhost立即向Apache(2.4)访问日志写入一行,并返回2

php - 使用 PHP 的 file_get_contents 后将类添加到 SVG 元素

我需要获取SVG图像并将图像插入页面。我正在使用以下方法获取图像:输出类似插入到页面后如何向SVG元素添加类?如:或定位到路径元素:任何帮助都会很好,谢谢! 最佳答案 您可以将svg存储为PHP变量,然后使用DOMDocument()功能来完成此操作。$svg=file_get_contents("logo.svg");$dom=newDOMDocument();$dom->loadHTML($svg);foreach($dom->getElementsByTagName('svg')as$element){$element->se

php - 是否有比 file_get_contents 占用更少内存或更有效的合并 MP3 的方法?

我需要将几个mp3文件合并为一个。我目前正在这样做:$combinedFiles="";$dir=$_POST['dir'];if($handle=opendir($dir)){while(false!==($entry=readdir($handle))){if($entry!="."&&$entry!=".."){$combinedFiles.=file_get_contents(urldecode($dir."/".$entry));}}closedir($handle);}file_put_contents("mp3/".$dir.".mp3",($combinedFiles)