Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,664 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,165 people online right now. Registration is fast and FREE... Join Now!




Parsing Fopen();

 
Reply to this topicStart new topic

Parsing Fopen();

Dr. Tim
post 24 Nov, 2002 - 04:06 PM
Post #1


D.I.C Addict

****
Joined: 20 Mar, 2002
Posts: 993

How do i do that and then replace something in it?
User is offlineProfile CardPM

Go to the top of the page

fyrestorm
post 25 Nov, 2002 - 08:52 AM
Post #2


D.I.C Lover

Group Icon
Joined: 4 Apr, 2002
Posts: 3,103



Thanked 2 times

Dream Kudos: 228
My Contributions


open your file read it into a variable and then use the following:

CODE
$variable = str_replace("what you want to change", "what you want to change it to", $variable);


and then just rewrite it to your file

hope that helps...
User is offlineProfile CardPM

Go to the top of the page

Dr. Tim
post 25 Nov, 2002 - 01:31 PM
Post #3


D.I.C Addict

****
Joined: 20 Mar, 2002
Posts: 993

So I just put fpassthro($variable); right after that?
User is offlineProfile CardPM

Go to the top of the page

fyrestorm
post 25 Nov, 2002 - 02:58 PM
Post #4


D.I.C Lover

Group Icon
Joined: 4 Apr, 2002
Posts: 3,103



Thanked 2 times

Dream Kudos: 228
My Contributions


ummm, i was thinking along the lines of fwrite()
User is offlineProfile CardPM

Go to the top of the page

Dr. Tim
post 25 Nov, 2002 - 03:27 PM
Post #5


D.I.C Addict

****
Joined: 20 Mar, 2002
Posts: 993

DrTim05: here is my dilema
DrTim05: i want to open a variable
DrTim05: and parse out "href=\"" and replace it with something
iamfyrestorm: i told you how to do that on dic
DrTim05: yeah
DrTim05: but u were using fwrite()
DrTim05: i dont need that
iamfyrestorm: you were talking about files
iamfyrestorm: and writing to them
iamfyrestorm: that's why i used fwrite
DrTim05: no no no
DrTim05: here
DrTim05: use this as an example
DrTim05: http://flashages.com/seekit.php
DrTim05: u see what i mean
DrTim05: type in a url
DrTim05: u understand?
iamfyrestorm: hang on, i'm working
DrTim05: oh okay
iamfyrestorm: do me a favor and post this on dic
iamfyrestorm: that way i can come back to it
iamfyrestorm: i'm trying to meet a deadline


---- Dont ask.... Its for fyrestorm.
User is offlineProfile CardPM

Go to the top of the page

fyrestorm
post 25 Nov, 2002 - 03:36 PM
Post #6


D.I.C Lover

Group Icon
Joined: 4 Apr, 2002
Posts: 3,103



Thanked 2 times

Dream Kudos: 228
My Contributions


ok now, you want to take out the http://

so you have the form that recieves a url and the txt box has a variable

do this:
CODE

$variable = str_replace("http://", "what you want to change it to", $variable);

any questions?
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 05:44AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month