Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7650407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:14:42+00:00 2026-05-31T11:14:42+00:00

I have a string with the following content http://www.mysite.com/test.php?http://www.anotherwebsite.com how can i save the

  • 0

I have a string with the following content

http://www.mysite.com/test.php?http://www.anotherwebsite.com

how can i save the second url in a php variable?

i mean, the url after the interrogation mark.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T11:14:43+00:00Added an answer on May 31, 2026 at 11:14 am

    If you had the following

    $double_url = 'http://www.mysite.com/test.php?http://www.anotherwebsite.com';
    

    then you could do this

    $second_url = substr(strstr($double_url, '?http'), 1);
    

    OR this

    $second_url = preg_replace('/.*\?(http.*)/', '$1', $double_url);
    

    OR this

    $second_url = substr($double_url, strpos($double_url, '?http')+1);
    

    OR many other approaches that will give you the same result.

    I am concerned with using ? as a delimiter between URLs because the ? is a valid and important part of the full URI. For this reason my examples use '?http' instead of just '?' but there are still potential pitfall situations even with '?http'

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following string: Test, User < test@test.com >, Another, Test < another@test.com >,
I have the following code in JS: new Ajax.Request('http://www.some_random_url.com', { parameters: { start :
I have the following code var postData = ; var req = HttpWebRequest.Create(http://www.imageshack.us/upload_api.php); req.ContentType
Assume I have the following string: Hellotoevryone<img height=115 width=150 alt= src=/Content/Edt/image/b4976875-8dfb-444c-8b32-cc b47b2d81e0.jpg />Iamsogladtoseeall. This
I have the following method: public void PutFile(string ID, Stream content) { try {
I have the following contents in my XML file: <items> <item id=1><content><![CDATA[<p>string</p>]]></content></item> </items> I
Suppose I have following string: String asd = this is test ass this is
In my .xhtml page, I have the following form: <ui:composition xmlns:ui=http://java.sun.com/jsf/facelets template=./../template/CustomerTemplate.xhtml xmlns:h=http://java.sun.com/jsf/html xmlns:f=http://java.sun.com/jsf/core
I have following html in string and i have to extract the content only
I have used this: Generate Google Analytics events (__utm.gif requests) serverside and this: http://www.garyrgilbert.com/blog/index.cfm/2008/10/21/Tracking-Digital-Content

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.