草庐IT

match_content

全部标签

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 - preg_match 的正则表达式

这个问题在这里已经有了答案:HowdoyouparseandprocessHTML/XMLinPHP?(31个答案)关闭7年前。我得到以下字符串:ElFTkSuQmCC"alt=""width="auto"height="auto"/>XX,X%并且想要“XX,X”,所以我构建了以下正则表达式:/QmCC"alt=""width="auto"height="auto"\/>\n(.*?)%/我在线测试了它并找到了XX,X的匹配项,但是当我尝试使用以下代码在php中执行它时preg_match_all('/REGEX/',$string,$match);不匹配。你有什么建议吗?字符串肯定

PHP - Preg_match 最短匹配

我正在尝试从此字符串中获取“内容”:$string="startstartcontentend";像这样使用preg_match:preg_match('/start(.*?)end/',$string,$matches);echo$match[1];但是,问题是$matches[1]返回startcontent而不仅仅是content因为有两个start在$string中(也许更多)如何使用preg_match只获取content部分? 最佳答案 使用否定前瞻:$string="startstartcontentend";preg

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)

php - 如何解析<media :content> tag in RSS with simplexml

我的RSS结构来自http://rss.cnn.com/rss/edition.rss是:http://www.cnn.com/intl_index.html...http://www.cnn.com/2017/01/11/politics/russia-rejects-trump-allegations/index.htmlhttp://www.cnn.com/2017/01/11/politics/russia-rejects-trump-allegations/index.htmlWed,11Jan201714:44:49GMT...如果您像这样使用simplexml解析此XML

用于分割字符串的 PHP preg_match_all 正则表达式

任何人都可以帮助完成我的正则表达式吗?我的字符串格式如下:{p:19}Ja?DumöchtestzurKönigin?{p:20}Hmm...DubistgekommenumdenTitelKriegerinzuerhalten?Verstehe.DasistganzschöntapferfürsoeinejungeDame.DieKöniginwirdsicherauchsehrüberraschtsein.{t:19}Bittesehr,gehdirekthinein.{t:20}TreibeDichhiernichtherum,wennDuhiernichtszusuchenha

php - 以 url 作为变量的 file_get_contents

我可以使用类似这样的方法来检索域外部的页面吗?我传递了一个变量并想从abc.com检索结果。是否可以将$fetcher传递给file_get_contents以检索页面内容?当我点击这个php页面时,我得到了空白页面。但是如果我使用类似的东西,它又可以正常工作了这里发生了什么?对此有一些技术解释吗? 最佳答案 您应该在$q_pass上使用urlencode。我猜你在query_passed中传递了一个带有空格的值。 关于php-以url作为变量的file_get_contents,我们在