+ Post New Thread
Page 2 of 2 FirstFirst 12
Results 16 to 27 of 27
Web Development Thread, Concatenate in PHP in Coding and Web Development; I was more thinking that it might contain a trailing newline, rather than trailing space. Is the server on unix ...
  1. #16


    tom_newton's Avatar
    Join Date
    Sep 2006
    Location
    Leeds
    Posts
    4,462
    Thank Post
    866
    Thanked 845 Times in 667 Posts
    Rep Power
    195
    I was more thinking that it might contain a trailing newline, rather than trailing space.

    Is the server on unix or windows?

  2. #17

    Hightower's Avatar
    Join Date
    Jun 2008
    Location
    Cloud 9
    Posts
    4,920
    Thank Post
    494
    Thanked 690 Times in 444 Posts
    Rep Power
    241
    The server is a WAMP setup on Server 2003. The text file is stored in the same location. I'm going to try trimming the $url before entering the "\n"

  3. #18

    Hightower's Avatar
    Join Date
    Jun 2008
    Location
    Cloud 9
    Posts
    4,920
    Thank Post
    494
    Thanked 690 Times in 444 Posts
    Rep Power
    241
    I used the trim function - still got the same...

  4. #19

    CESIL's Avatar
    Join Date
    Nov 2006
    Location
    Hampshire
    Posts
    1,403
    Thank Post
    109
    Thanked 267 Times in 198 Posts
    Rep Power
    168
    What editor are you viewing the file in?

    Notepad does not recognize *nix style returns (\n) it needs \n\r

    Textpad reads *nix files properly so that is what I use.

  5. #20

    Hightower's Avatar
    Join Date
    Jun 2008
    Location
    Cloud 9
    Posts
    4,920
    Thank Post
    494
    Thanked 690 Times in 444 Posts
    Rep Power
    241
    It doesn't matter which editor I use. Windows Text Editor puts [][], Notepad++ and others don't but there is still more than one line break.

    \n puts in [][] or 2 line breaks (depending on text editor)

    \r puts in [][][] or 3 line breaks (depending on text editor)

    It works - I just want it to look tidier rather than loads of un-needed whitespace.

  6. #21

    CESIL's Avatar
    Join Date
    Nov 2006
    Location
    Hampshire
    Posts
    1,403
    Thank Post
    109
    Thanked 267 Times in 198 Posts
    Rep Power
    168
    Can you post the code you are now using?

    I have just tried the code you posted originally and it is producing a perfect single line spaced file.

  7. #22

    Hightower's Avatar
    Join Date
    Jun 2008
    Location
    Cloud 9
    Posts
    4,920
    Thank Post
    494
    Thanked 690 Times in 444 Posts
    Rep Power
    241
    Is it possible that it is part of the WAMP setup?

  8. #23

    CESIL's Avatar
    Join Date
    Nov 2006
    Location
    Hampshire
    Posts
    1,403
    Thank Post
    109
    Thanked 267 Times in 198 Posts
    Rep Power
    168
    I have just tried the same code on my WAMP setup and it works ok...

  9. #24

    Hightower's Avatar
    Join Date
    Jun 2008
    Location
    Cloud 9
    Posts
    4,920
    Thank Post
    494
    Thanked 690 Times in 444 Posts
    Rep Power
    241
    So it's something caused in another area of the code? Or something caused within my WAMP setup?

    I'll post the rest of the code up later - but can't really see how. It must be WAMP.

  10. #25

    Hightower's Avatar
    Join Date
    Jun 2008
    Location
    Cloud 9
    Posts
    4,920
    Thank Post
    494
    Thanked 690 Times in 444 Posts
    Rep Power
    241
    Ok, another thing that I would like to do with this script.

    Currently I'm pulling the domain name using PHP_HOST_URL which gives me (for example) Google if I enter http://www.google.com/pagehere

    What I would like to do is enter an address like http://www.google.com/pagehere and get google.com

    Anyone done this before or know how to do it?

  11. #26
    browolf's Avatar
    Join Date
    Jun 2005
    Location
    Mars
    Posts
    1,524
    Thank Post
    106
    Thanked 88 Times in 74 Posts
    Blog Entries
    46
    Rep Power
    40
    u want to look at 'regular expressions'

    there's some php examples here:
    Handy PHP - A Few Handy PHP Regular Expressions (RegEx)

  12. #27


    tom_newton's Avatar
    Join Date
    Sep 2006
    Location
    Leeds
    Posts
    4,462
    Thank Post
    866
    Thanked 845 Times in 667 Posts
    Rep Power
    195
    PHP: parse_url - Manual might be a good start - if you want to cut off the www then you can do that afterward - s/^www//i might work!

SHARE:
+ Post New Thread
Page 2 of 2 FirstFirst 12

Similar Threads

  1. PHP Help!
    By Cravon in forum Coding
    Replies: 2
    Last Post: 20th November 2007, 05:05 PM
  2. php no errors
    By browolf in forum Web Development
    Replies: 3
    Last Post: 23rd May 2007, 12:06 PM
  3. Help with PHP
    By Gatt in forum Web Development
    Replies: 1
    Last Post: 14th November 2006, 09:01 PM
  4. php help
    By beeswax in forum Windows
    Replies: 33
    Last Post: 14th October 2005, 04:51 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •