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

  • Home
  • SEARCH
  • 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 6575385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:22:50+00:00 2026-05-25T15:22:50+00:00

This may seem odd but I’m simply trying to put a url together. The

  • 0

This may seem odd but I’m simply trying to put a url together.
The first part ($first) I get from user input using strrpos() and substr() with “/”.
The exact file I want to get to is fixed ($second) so all I think I need to do is this:

$first = "http://www.somedomain.de/somepath/";
$second = "thexml.xml";
$url = $first.$second;

BUT: Although I use trim() on every part there still is some whitespace between the two parts when I print $url.

When I try to navigate to $url the whitespace is replaced by a “%”.
The path itself is correct, when I get rid of the whitespace/ % manually in my browser’s adress bar.

I also tried putting the two strings together with an array and implode() but the output stays the same.
What am I doing wrong?

Update from Lisa

ok, so I printed $first and $second separately and there are no whitespaces. it seems to be appearing when I concatenate them and exactly where the two strings are put together.

Any other ideas?


ok, so I printed $first and $second separately and there are no whitespaces. it seems to be appearing when I concatenate them and exactly where the two strings are put together.

Any other ideas?

  • 1 1 Answer
  • 2 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-25T15:22:51+00:00Added an answer on May 25, 2026 at 3:22 pm

    Most likely, the code you’re editing or the inputs (user, database, etc.) is not what you expect. Try trimming down (no pun intended) the code to a minimal example. For example, go from

    $first = "http://www.somedomain.de/somepath/";
    $second = "thexml.xml";
    $url = $first.$second;
    echo $url; // No space
    

    to

    $first = $_POST['url'];
    $second = "thexml.xml";
    $url = $first.$second;
    echo $url; // If this contains a space, the input contains the offending space
    

    step-by-step to find the mistake.

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

Sidebar

Related Questions

This may at first seem like an odd question, but when a cin request
This may seem like an odd question but I was talking to a friend
This may seem a bit odd, but I really need to create a workaround
I am still learning SQL so this may seem a very odd question, but
This may seem like a rudimentary request, but I can't seem to get it
this may seem a little odd, but it would make for a convenient way
This may seem like an odd question, but I need to find a closed-source
This may seem like an odd question, but I have my own reasons for
this may seem odd, but I actually need a PHP script that WILL time-out,
This may seem like an odd one, but I want to be able to

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.