473,395 Members | 2,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Retrieve current URL aftr

106 100+
I want to retrieve

http://www.mysite.com/directory/page.php

just directory/page.php

How do I do that?
May 9 '10 #1

✓ answered by chimpu

Well , use string explode function and then you will get your result .
See the code below


Expand|Select|Wrap|Line Numbers
  1. <?php
  2. /**
  3. code owner: Rahul Sinha
  4. contact : rahul@zimaudio.com/rahulazm@gmail.com
  5. **/
  6. $str='http://www.mysite.com/directory/page.php';
  7. $arr = explode("com/",$str);
  8. echo $arr[1]; // prints directory/page.php
  9.  
  10. ?>
Regards,
Chimpu

3 1641
chimpu
1
Well , use string explode function and then you will get your result .
See the code below


Expand|Select|Wrap|Line Numbers
  1. <?php
  2. /**
  3. code owner: Rahul Sinha
  4. contact : rahul@zimaudio.com/rahulazm@gmail.com
  5. **/
  6. $str='http://www.mysite.com/directory/page.php';
  7. $arr = explode("com/",$str);
  8. echo $arr[1]; // prints directory/page.php
  9.  
  10. ?>
Regards,
Chimpu
May 10 '10 #2
londres9b
106 100+
very thanks!
Jun 18 '10 #3
londres9b
106 100+
I have a related follow up question

http://bytes.com/topic/php/answers/891626-php-explode
Jul 16 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: wonder | last post by:
Dan Greenblatt wrote: > wonder wrote: > >> Hi, >> >> How can I pass the url of the current webpage link to a python script in html? >> >> thanks
2
by: Stefano | last post by:
Hi all, is it possibile to retrieve the current Windows User Handle from ASP code? I would like to retrieve the correspondent in ASP for thi piece of ASP.NET code: WindowsIdentity id =...
79
by: Klaus Bonadt | last post by:
In order to protect software from being copied without licence, I would like to use something like a key, which fits only to the current system. The serial number of the CPU or the current...
2
by: Sylvain Larin | last post by:
I want to give the access right to my application based on who is currently logued in Windows. How can I get the current username from Windows? TIA
4
by: Penny | last post by:
Hi all, How can I retrieve the current page url(and parameters/arguments) using ASP code? The current page is an asp search results page so the url includes the page name and the...
1
by: Valerian John | last post by:
Hi, folks: I am looking for a way to get the name of the current page in code. Just the page name, eg. login.aspx. I have used Request.CurrentExecutionFilePath and the Split method of the...
11
by: motion musso aka: sathia | last post by:
this is it, how can i get the current index? couldn't figure it out. thank you for(i=0;myarray.length<i;i++){ do_something(); //i need the current myarray } bye bye
7
by: rockdc1981 | last post by:
i have audit trail module using this code... Option Compare Database Option Explicit Public Function AuditTrail() On Error GoTo Err_Audit_Trail 'ACC2000: How to Create an Audit Trail...
5
by: =?Utf-8?B?QXhlbCBEYWhtZW4=?= | last post by:
Hi, I've created a class library assembly containing several string resource files, like: - TableColumns.resx - TableColumns.de.resx - General.resx - General.de.resx
7
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a C# logging assembly with a static constructor and methods that is called from another C# Assembly that is used as a COM interface for a VB6 Application. Ideally I need to build a file...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.