adv Posted January 3, 2009 Share Posted January 3, 2009 hello i`ve played a little in php and there`s a thing that i don`t understand. I have a file : test.txt , inside of it i have &test=testing&value=cool&blabla=ok and in php $h=file_get_contents('test.txt'); parse_str($h); i know that parse_str() makes strings into variables and u can acces $test as a variable but the thing is i dont understand how it keeps it .. where it keeps the strings made into variables how does it know.. kinda weird question :| sorry if i didnt make myself clear ... my english is buggy Quote Link to comment https://forums.phpfreaks.com/topic/139371-solved-quick-question-d/ Share on other sites More sharing options...
kenrbnsn Posted January 3, 2009 Share Posted January 3, 2009 Just use it: <?php $str = '&test=testing&value=cool&blabla=ok'; parse_str($str); echo $test; ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/139371-solved-quick-question-d/#findComment-728963 Share on other sites More sharing options...
adv Posted January 4, 2009 Author Share Posted January 4, 2009 ken i knew all that i`ve used file_get_contents intentionally i just wanted to know how php memorize it all but the thing is i dont understand how it keeps it .. where it keeps the strings made into variables how does it know.. not to show me i can echo it :| Quote Link to comment https://forums.phpfreaks.com/topic/139371-solved-quick-question-d/#findComment-729087 Share on other sites More sharing options...
premiso Posted January 4, 2009 Share Posted January 4, 2009 It keeps them in a GET/POST array. <?php echo $_GET['test']; ?> Would output "testing". Quote Link to comment https://forums.phpfreaks.com/topic/139371-solved-quick-question-d/#findComment-729089 Share on other sites More sharing options...
adv Posted January 4, 2009 Author Share Posted January 4, 2009 thanks i have another question and i dont think is needed to open a new thread my question is this i have email.php <?php if(isset($_GET['sendEmail'])){ $sendEmail=1; $value1=$_GET['value1']; $value2=$_GET['value2']; $value3=$_GET['value3']; } if($senEmail==1){ mail('email.com','subject','testing'); } ?> and in another file i have this <?php $remote_send='http://site.com/email.php?'; $send_mail=1; $value1='firstvalue'; $value2='secondvalue'; $value3='thirdvalue'; if($send_mail==1){ $remote_send.='sendEmail=&value1='.urlencode($value1).'&value2='.urlencode($value2).'&value3='.urlencode($value3); } ?> but it doesnt send , i dont understand why if i do this : http://site.com/email.php?sendEmail=&value1=firstvalue&value2=secondvalue&value3=thirdvalue if sends the email Quote Link to comment https://forums.phpfreaks.com/topic/139371-solved-quick-question-d/#findComment-729373 Share on other sites More sharing options...
kenrbnsn Posted January 4, 2009 Share Posted January 4, 2009 You're not invoking the script that sends the email from the first script, you're just setting a bunch of variables. Ken Quote Link to comment https://forums.phpfreaks.com/topic/139371-solved-quick-question-d/#findComment-729383 Share on other sites More sharing options...
adv Posted January 4, 2009 Author Share Posted January 4, 2009 thanks ken but how do i invoke it ? Quote Link to comment https://forums.phpfreaks.com/topic/139371-solved-quick-question-d/#findComment-729402 Share on other sites More sharing options...
kenrbnsn Posted January 4, 2009 Share Posted January 4, 2009 Make it into a clickable link. Or use the header function to transfer to the page. Or use curl to invoke it without transferring to it. Ken Quote Link to comment https://forums.phpfreaks.com/topic/139371-solved-quick-question-d/#findComment-729432 Share on other sites More sharing options...
adv Posted January 4, 2009 Author Share Posted January 4, 2009 thanks alot ken i`ve got it :* Quote Link to comment https://forums.phpfreaks.com/topic/139371-solved-quick-question-d/#findComment-729486 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.