php: convert all relative urls in absolute urls

maybe this is an old question but i'm trying as a personal experiment to fetch a page form the web and the make a copy out of it with all the relative urls, links, href, src etc withn absolute urls i'm using CURL to fetch hte page and I have now a $html variable that contains all the code.. so what; the next step? shoud i use preg_replace? how? thanks 下一步是将它放入一个HTML解

php:将所有相关网址转换为绝对网址

也许这是一个古老的问题,但我试图作为一个个人实验,从Web获取一个页面,并与所有相关的URL,链接,HREF,SRC等与绝对网址 我使用CURL来获取hte页面,并且现在有一个包含所有代码的$ html变量.. 所以呢; 下一步? 我应该使用preg_replace吗? 怎么样? 谢谢 下一步是将它放入一个HTML解析器中,并遍历树,查找和修复标签上a href属性, img标签上a src属性等等。解析器将能够将该树重新发射为一个字符串一旦你完成了。

replace: replacing using %

I'm using the function preg_replace but I cannot figure out how to make it work, the function just doesn't seem to work for me. What I'm trying to do is to convert a string into a link if any word contains the % (percentage) character. For instance if I have the string "go to %mysite", I'd like to convert the mysite word into a link. I tried the following... $data

替换:替换使用%

我正在使用函数preg_replace,但我无法弄清楚如何使它工作,该函数似乎不适用于我。 我想要做的是将字符串转换为链接,如果任何单词包含%(百分比)字符。 例如,如果我有字符串“go to%mysite”,我想将mysite字词转换为链接。 我尝试了以下... $data = "go to %mysite"; $result = preg_replace('/(^|[s.,:;]+)%([A-Za-z0-9]{1,64})/e', '\1%<a href=#>\2</a>', $data); ...但它不起作用。 任

Match only a word, or a hyphenated word

I am trying to use preg_match for form validation. The Regex needs to match any input that doesn't contain only characters, and characters followed by a hyphen also followed by more characters. In other words the regex should catch any input that isn't a word made up of characters [az] and a hyphenated word (where there exists only one hyphen in the middle). The regex should also cat

只匹配一个字或连字符

我正在尝试使用preg_match进行表单验证。 正则表达式需要匹配任何不仅包含字符的输入,而且字符后跟一个连字符,后面跟着更多的字符。 换句话说,正则表达式应该捕获任何不是由字符[az]和带连字符的单词组成的单词(中间只有一个连字符)的输入。 正则表达式还应该带有尾随连字符(在连字符后面没有其他单词,例如“hello”)并且还应该用起始连字符(例如“ - hello”)来捕捉单词。 任何帮助将不胜感激。 尝试下面的代码

Need Help on OAuthException Code 2500

I am trying to develop an Facebook application (apps.facebook.com/some_app) using PHP where I need to present some information based on user's music interests. I found that its under "user_likes > games". My problems are as follows: To gain access, I have implemented the oauth dialog method as suggested in API in my index page. $auth_url = "http://www.facebook.com/dialog/oa

需要关于OAuthException代码2500的帮助

我正在尝试使用PHP开发Facebook应用程序(apps.facebook.com/some_app),我需要根据用户的音乐兴趣呈现一些信息。 我发现它在“user_likes>游戏”下。 我的问题如下: 为了获得访问权限,我已经在我的索引页面中实现了API中建议的oauth对话框方法。 $auth_url = "http://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . urlencode($canvas_page) ."

curl with post method

salam i want to get some xml responses from a server but this server accept only xml request i have this example of code <?php $url = "http://www.pj.ma/phonexmlfeeds"; $post_string = '<?xml version="1.0 encoding="UTF-8" ?><search_requests> <search_request id="req1"><content>statut=1 AND linguistic_expansion2(lingex_qui_quoi,1,0,"qui_quoi","Restaurant",LIN_EXA

用post方法卷曲

萨拉姆 我想从服务器获取一些XML响应 但是这个服务器只接受xml请求 我有这个代码的例子 <?php $url = "http://www.pj.ma/phonexmlfeeds"; $post_string = '<?xml version="1.0 encoding="UTF-8" ?><search_requests> <search_request id="req1"><content>statut=1 AND linguistic_expansion2(lingex_qui_quoi,1,0,"qui_quoi","Restaurant",LIN_EXACT|LIN_LEM0|LIN_LEM1|LIN_LEM2|LIN_SYN1|

PHP on Tomcat 8

I had found quite a few guides how to make PHP run on Tomcat, but all were on previous versions. I tried all of them and all I could manage to display is a blank page and the code is still not fired. I understand that Tomcat is build for Java application and not PHP, but I need to find a way to do that with Tomcat 8. Does any of you know a resource that could help me with this? I tried the gu

PHP在Tomcat 8上

我发现了很多关于如何让PHP在Tomcat上运行的指南,但都是以前的版本。 我尝试了所有这些,我所能够显示的只是一个空白页面,代码仍然没有被解雇。 我知道Tomcat是为Java应用程序构建的,而不是PHP,但我需要找到一种方法来用Tomcat 8来实现这一点。您是否有任何人知道可以帮助我的资源? 我尝试了以下链接中的指南,但没有运气: http://tojackwu.blogspot.com/2008/10/php-5-on-tomcat-6-installation.html http://php-

Multiple dynamic firewalls and CAS servers in Symfony2

I am developing an application in Symfony to manage multiple schools. The application has multiple databases, one for each school, and multiple CAS servers. If I only manage a school, the configuration would be like this: # config.yml be_simple_sso_auth: admin_sso: protocol: id: cas version: 2 server: id: cas login_url: https

Symfony2中有多个动态防火墙和CAS服务器

我正在Symfony开发一个应用程序来管理多所学校。 该应用程序有多个数据库,每个学校一个,以及多个CAS服务器。 如果我只管理一所学校,配置将如下所示: # config.yml be_simple_sso_auth: admin_sso: protocol: id: cas version: 2 server: id: cas login_url: https://cas01.example.com/SCHOOLID/login logout_url: https://cas01.examp

Do not require friends list

I'm currently scoping for just email on my Facebook login link $params = array( 'redirect_uri' => $redirect_url, 'scope' => 'email' ); But Facebook states that the user is providing access to their friend list. Users will not login because of this requirement. Does anyone know how to turn it off? This is expected behavior. By granting access to your application (even wit

不要求朋友名单

我目前正在关注我的Facebook登录链接上的电子邮件 $params = array( 'redirect_uri' => $redirect_url, 'scope' => 'email' ); 但Facebook表示,用户正在提供对他们的朋友列表的访问。 由于此要求,用户不会登录。 有谁知道如何关闭它? 这是预期的行为。 通过授予对应用程序的访问权限(即使没有指定任何权限),一些信息已经提供给您的应用程序。 查看处理授予应用程序的基本权限的文档页面: 公开

How get facebook user ID from my application?

I created a facebook application and send request to a user through below code.Now when a user allow my application then i need his id and email address into my canvas url.But on that below code user don't go to my canvas URL.So,Please help me to solve ,how a user go to my canvas url when he allow my application and i get the user id of that user?My code is below: require_once 'facebook

如何从我的应用程序获取Facebook用户ID?

我创建了一个Facebook应用程序,并通过下面的代码向用户发送请求。现在,当用户允许我的应用程序时,我需要他的ID和电子邮件地址到我的画布url.But在下面的代码用户不要去我的画布URL。所以,请帮助我解决,当用户允许我的应用程序时,用户如何访问我的画布网址,并获取该用户的用户ID?我的代码如下: require_once'facebook.php'; $ facebook = new Facebook(array( 'appId'=>'#######',

How many friends on Facebook

Possible Duplicate: How to get a list of user's friends via facebook? I have a Facebook App and I want to know how many friends a user has. When the user login on my web through Facebook API, I setup the permissions: header('Location: ' . $facebook->getLoginUrl(array('req_perms' => 'email, user_birthday, user_location'))); But dunno how to ask Facebook API about the friends that

Facebook上有多少朋友

可能重复: 如何通过Facebook获取用户朋友的列表? 我有一个Facebook应用程序,我想知道一个用户有多少个朋友。 当用户通过Facebook API在我的网上登录时,我设置了权限: header('Location: ' . $facebook->getLoginUrl(array('req_perms' => 'email, user_birthday, user_location'))); 但不知道如何问Facebook用户有关用户的朋友。 林想知道你的电子邮件与此代码: if($facebook->api(array('method'=&g