User Profile

Collapse

Profile Sidebar

Collapse
giorgisp
giorgisp
Last Activity: May 14 '10, 06:52 PM
Joined: May 4 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Oh, I found what I was doing wrong! substr() has parameters on where to search, start and how much characters to return from the start character, not the end character. So the updated code is:

    Code:
    <?php
    
    $break = "\n"; //set the line break character
    $textfile = "cake"; //set the file we want to read
    $file = fopen("$textfile", 'r'); // open the file in read mode
    $data =
    ...
    See more | Go to post

    Leave a comment:


  • Thanks for the reply. The file has in each line an email address and some text next to it seperated with a space. So I give the email address I want to the script with the get method (url variable) and I want it to echo the email address along with the text next to it (from the start of the line to the end of the line). I just wrote this code to do this but it didn't work as I expected. Sometimes it gives me back more characters than what I want....
    See more | Go to post

    Leave a comment:


  • giorgisp
    started a topic How to echo text from character 2-27 in a file
    in PHP

    How to echo text from character 2-27 in a file

    I have a file and I want to echo the text from character 2 to 27. How can I do this?

    Thanks
    See more | Go to post

  • cleaned the links

    Also, is there any way to write a url into the file but at the end? Example:

    http://site1.com/whatever.php
    http://site2.com/whatever.php
    http://site3.com/whatever.php

    and write a new url at the end:

    http://site1.com/whatever.php
    http://site2.com/whatever.php
    http://site3.com/whatever.php
    http://site4.com/whatever.php
    See more | Go to post

    Leave a comment:


  • Thank you very much!
    See more | Go to post

    Leave a comment:


  • How can I pick and show a specific line from a text file with PHP?

    I have a text file with URLs. It is something like this below:

    http://site1.com/whatever.php
    http://site2.com/whatever.php
    http://site3.com/whatever.php
    http://site4.com/whatever.php
    http://site5.com/whatever.php
    http://site6.com/whatever.php
    http://site7.com/whatever.php
    ....

    And I want to:
    -Pick the first URL and put it in a variable
    -Pick a random URL...
    See more | Go to post
No activity results to display
Show More
Working...