Questions tagged [parse-url]

url-parsing is the process of splitting a Universal Resource Locator into its component parts usually to extract parameters made as part of a request or to filter requests. The url http://parts.web.site/discount?part=51762 might be parsed to identify "/discount" and "part=51762" was requested

Overview

A Universal Resource Locator is a character string that represents an internet resource.

An example of a URL might be:

ftp://my.photo.site:21/static/photo?id=82713&format=png

url-parsing is the process of splitting a URL into its component parts, usually to retrieve request parameters or to filter requests. The example above might be parsed into:

scheme: ftp
domain: my.photo.site
port: 21
path: /static/photo
query_string: id=82713 format=png

The process of parsing a url can be managed by a library like the python urlparse, by server frameworks or string processing functions like regex.

Links

94 questions
0
votes
3 answers

PHP strrchr parse int

I've got a problem. This is my PHP code : $extract = $query; $extractpoint = strrchr($extract, "."); So, $extract is a parse_url of my website address. Exemple : http://test.com?param.6 $extract = param.6 and $extractpoint = .6 BUT, I want a…
0
votes
1 answer

Fetch url response via gulp

I'm working on a Gulp task that would fetch the result from an external API (https://api.wordpress.org/secret-key/1.1/salt/) and store it in a variable for use further down the pipeline. I've tried using node's parseurl package like this const gulp…
pixeline
  • 17,669
  • 12
  • 84
  • 109
0
votes
2 answers

check for subdomain in parse_url

I am trying to write a function to just get the users profile id or username from Facebook. They enter there url into a form then I'm trying to figure out if it's a Facebook profile page or other page. The problem is that if they enter an app page…
Brooke.
  • 3,691
  • 13
  • 49
  • 80
0
votes
3 answers

changing a given url to return only the domain

I'm getting a url from a form, this way: $input_website = isset($_POST['website']) ? check_plain($_POST['website']) : 'None'; I need to get back a naked domain name(for some API integration), for example: http://www.example.com will return as…
Noam Gur
  • 65
  • 11
0
votes
2 answers

Parsing out "site.com" from a passed variable in PHP?

I'm passing through a variety of URLs in a global variable called target_passthrough, so the URL of a page might look like: http://www.mysite.com/index.php?target_passthrough=example.com Or something like that. Formats for that variable may be a…
0
votes
1 answer

wordpress php get queries from URL

I am making a plugin for wordpress that is located at companyname.com/event/countdown/. On this page I would like to dynamically some information from the url string to show a countdown the company can email. So in the url…
Packy
  • 3,405
  • 9
  • 50
  • 87
0
votes
2 answers

PHP Parse URL-encoded string with embedded JSON

I am having a problem parsing the following xAPI string into an array. The issue is that both parse_str() and parse_url() parse the URL within the quotes contained in the [content] ... which kills the JSON format. Authorization=Basic…
Beto
  • 151
  • 2
  • 8
0
votes
0 answers

Get domain from URL without question mark

Running parse_url() on : This kind of URLs : http://mondomom.com extracts successfully mondomom.com and returns it as host. This kind of URLs : http://www.mondomom.com/?sdfdsfsd=dsdfsdf extracts successfully mondomom.com and returns it as host. But…
Alucard
  • 1,814
  • 1
  • 21
  • 33
0
votes
1 answer

parse_url and removing subdomain

I'm wanting to strip out everything from a URL but the domain. So https://i.stack.imgur.com/inhSc.jpg becomes imgur.com. $url = 'https://i.stack.imgur.com/inhSc.jpg'; $parsedurl = parse_url($url); $parsedurl = preg_replace('#^www\.(.+\.)#i', '$1',…
ditto
  • 5,917
  • 10
  • 51
  • 88
0
votes
3 answers

PHP get absolute path from URL

I have this URL on localhost: http://localhost:7777/somesite/sites/default/files/devel-7.x-1.5.zip and want to get c:\xampp\htdocs\somesites\default\files\devel-7.x-1.5.zip. As mentioned on this question PHP: Get absolute path from absolute URL: …
Beakal
  • 134
  • 1
  • 4
  • 15
0
votes
2 answers

How can i get then "=" Php parse

I need help on php. I get full link with this code $url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; My link output is: http://localhost/Mid/photo-gallery/photos.php?ref=3%20%20ID=3 How can i get "3" ? I need last number. This number can be…
cimicimi
  • 208
  • 1
  • 2
  • 11
0
votes
2 answers

Shell script: Parse URL for iFrame and get iFrame URL

I want to parse my website, search for the