草庐IT

dynamic-content

全部标签

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

javascript - fb分享不带og :image dynamically

我正在编写一个网站,其中包含多个页面(用户提交)。这些页面将被访问为http://www.mywebsite.com/?page=page1,http://www.mywebsite.com/?page=page2等等,我希望每个页面都有一个类似fb的共享按钮(在加载内容后),以便当他们单击该按钮时,它会在他们的fb中发布该特定页面(及其图像)。到目前为止,一切似乎都适合我,直到我在过去两天遇到这个让我头疼的问题。一些论坛说open-graph和fb-share有问题,但我仍然希望我的要求是全局性的并且它必须有效。虽然fb-like和fb-share在共享特定URL方面工作正常,但它不

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)

php - 交响乐 2.8 : How to dynamically set database params based on the hostname

我有100个三级域都指向同一个服务器,我有一个Symfony2.8项目。我需要Symfony能够连接到不同的数据库,具体取决于三级域。我知道我可以创建任意多的环境,但环境的语法更像是:-domainname.com/app_customer1.php/[..]-domainname.com/app_customer2.php/[..]-domainname.com/app_customer3.php/[..]White我想要这个URL结构:-customer1.domainname.com/[..]-customer2.domainname.com/[..]-customer3.dom

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