php - How to append variables to a url which already has variables? -
So, I'm currently a little complicated in position (for me this is), but I'm trying .
I would like to run on a snippet of HTML and will remove all links while talking about my own domain. Next I want to associate these URLs with the predefined string of GET Vars. For example, I '? I want to add var1 = 2 'and' var2 = 4 'to "like this"
The method I am currently applying is a simple preg_replace function (PHP), but when it It's interesting when I finally got some GET Wars, so how do I create a legal Junk URL? For example, it could create a URL like this: "Thus breaking GET data.
To finish, what I see is a regiment app that can cope with these scenarios, write my expanded URL and return it to the HTML snippet.
This is what I have done so far:
$ sHTML = preg_replace ("'href = \" ($ domainURL) *] [\ / $]) \ "'",' Href = "\ 1 '. $ Tag attached.' ', $ S HTML); Thanks in advance
its In addition it has been suggested that, I want to parse the 'query string', modify the resulting array in my needs and then use it to rebuild the query string. This way you will not have any duplicates within your query string and Do not disturb your question-parts with url-encoding
The complete example looks like (incremental code):
$ broken = parse_url ($ url); $ Query = parse_str ($ broken [' $ 'Broken [' query '] = http_build_query ($ query); $ broken [' scheme '];' $ ' // '$ broken [' host '] $ broken [' path ']'? ' . $ Broken ['query'] '#' $ break ['piece'];
Comments
Post a Comment