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
1 answer

Laravel 5.8: parse_url() expects parameter 1 to be string, array given

I want to insert some data into the DB like this via Eloquent: public function postDarkhast(Request $request) { RequestTable::create([ 'course_name' => 1, 'course_start' => 2, 'course_end' => 3, …
Pouya
  • 114
  • 1
  • 8
  • 36
0
votes
1 answer

Parsing URL for Specific Part of Path

How would I go about extracting a specific part of the path using PARSE_URL? For example, if I query... > WITH cte AS ( > SELECT CONCAT('http://', COLUMN1) AS URL FROM VALUES > ('www.url1.com/test'), > ('www.url1.com/test2/'), > …
0
votes
1 answer

How to parse_url without scheme in sql within snowflake?

I am trying to pull hostname and path from urls without scheme but parse_url doesn't works. What all other options do I have?
0
votes
1 answer

StringifyUrl with query-string creates ?type=fulltime&type=partime but i want ?type=fulltime.partime

I am using queryString with react to mutate some urls for api calls. I have next code useEffect(() => { const parsed = queryString.parseUrl(window.location.href); console.log('parsed',parsed) …
Mladen Milosavljevic
  • 1,720
  • 1
  • 12
  • 23
0
votes
2 answers

Get value from "url" parameter of url querystring which is & delimited

I am using PHP 7.4.1. I am trying to parse a rss feed from google. My links look like the…
Carol.Kar
  • 4,581
  • 36
  • 131
  • 264
0
votes
3 answers

Getting the second part of a URL through PHP

I'm trying to setup a page that pulls just a part of the URL but I can't even get it to echo on my page. Since I code in PHP, I prefer dynamic pages, so my urls usually have "index.php?page=whatever" I need the "whatever" part only. Can someone help…
0
votes
1 answer

How to get parameter from url split by colon (:)

I have this url: "http://example.com/search/dep_city:LON/arr_city=NYC". How can i get the values "LON" and "NYC" from this url in PHP? This would be easy if url would be in format "dep_city=LON" by using "$_GET['dep_city']" but in this case i am…
octav
  • 13
  • 2
0
votes
1 answer

How to parse a txt file from a url in the exact format to a textview?

I am try to parse a txt file from a url to a textview in my application the text is being display but the text are not display in the right format as it is online like spaces, next line, paragraph e.t.c. simply put what i want is> CHAPTER…
0
votes
1 answer

Input url validation php

I have problem with this code: $parse = parse_url($url); //$url is POST from input field $urls = $parse['host']; $domain = array('mydomain.com', 'mydomain.net'); if (!in_array($urls, $domain)) { echo 'invalid URL'; …
user3325605
0
votes
1 answer

PHP parse_str not getting all $_GET variables

I have a strange issue. Would like to fetch the $_GET variables from a string with parse_str. Which works except for the first variable. Makes me wonder if I have written the the syntax correctly. But yes I think I (probably) did. When I run the…
Alex
  • 1,223
  • 1
  • 19
  • 31
0
votes
1 answer

How to correct the code that gets the YouTube ID to work with the short URL

I have a script that allows to grab videos from YouTube. However, it doesn't work if I use short URLs. I think the problem is caused by the code that gets YouTube Id from URLs. Here are the lines I think are responsible for that: $youtube_url =…
0
votes
0 answers

Get parameters from url parse

I want to get parameters from url but i dont know how can do it. $url = parse_url($_SERVER['REQUEST_URI'])["path"]; I get the url with this code block. Its give me link like that /movies/2/delete I want to learn deleting 2 id movies from router.…
0
votes
1 answer

Problems removing HTTP:// from string (unserialized key)

I have urls that I need to remove either http:// or https:// from the string. So example I would like; http://www.google.co.uk to become just www.google.co.uk https://www.yahoo.com to become just www.yahoo.com The string ($url) is being retrieved…
Gizz
  • 1
  • 3
0
votes
1 answer

Parsing url using url-parse

I am using library to parse urls on my page: import * as urlParse from 'url-parse'; const parseUrl = url => { try { return urlParse(url); } catch (e) { return null; } }; The issue is when the url 'www.stackoverflow.com' is passed to the…
Afflatus
  • 933
  • 1
  • 12
  • 39
0
votes
1 answer

How to find out if last part of PHP_URL_PATH is a file or directory?

Context: I'm trying to hierarchically store URI's (starting with 3758 TLD's, further refined in domains, further refined in paths, further refined in querystrings) {and divided in protocols, ports, etc), basically storing the web as one big tree and…
edelwater
  • 2,650
  • 8
  • 39
  • 67