Hi,

I would like to know if there is a way to call a PHP script from another PHP script without to use the include.

Thanks.

    What do u mean by "calling another PHP script"
    from wat I understood... you can use

    $fhandle = fopen("pathtofile","rt");
    fpassthru($fhandle);
    fclose($fhandle);

    this should work.. as an alternative for include

    Good Luck
    TommYNandA

      Originally posted by tommynanda
      this should work.. as an alternative for include

      Except that that won't run the script being passed through - it will just dump all the source out to the client.

      The question I think should be asked first is "What's wrong with using include?"

        Except that that won't run the script being passed through - it will just dump all the source out to the client.

        It does dump source... if its a relative URL(like linkedfile.php)... if its a complete URL (like http://samedomainname.com/linkedfile.php) it runs the script and passes the output... and you are rite its not a complete replacement for include but it does the job except using variables

        TommYNandA

          Originally posted by Weedpacket
          The question I think should be asked first is "What's wrong with using include?"

          It's not being discussed here.

          I ever thought that a tech forum would be used to solve tech issues, instead to try to find "philosofical" aspects over the participants doubts.

          I just asked a question and it has nothing to do with have or have not "something wrong" with the include.

          If you dont know the answer to the TECH question, why lose your time posting an observation that will drive us to nowhere????

            Originally posted by tommynanda
            What do u mean by "calling another PHP script"
            from wat I understood... you can use

            $fhandle = fopen("pathtofile","rt");
            fpassthru($fhandle);
            fclose($fhandle);

            this should work.. as an alternative for include


            Good Luck
            TommYNandA

            Hi TommYNandA,

            Thanks for your answer. It helped a lot.
            Thanks again for a straight, objective and TECH answer.
            It's really why a forum exists for!

            Yan Kleber

              Originally posted by yankleber
              It's not being discussed here.

              I ever thought that a tech forum would be used to solve tech issues, instead to try to find "philosofical" aspects over the participants doubts.

              I just asked a question and it has nothing to do with have or have not "something wrong" with the include.

              If you dont know the answer to the TECH question, why lose your time posting an observation that will drive us to nowhere????

              Hmm.. are you trying to get flamed?

                hey yankleber,
                can I just point out that you asked a stupid question and got an answer from someone that is only trying to help!
                so in future, try not to be such an ass.

                  Originally posted by elementaluk
                  hey yankleber,
                  can I just point out that you asked a stupid question and got an answer from someone that is only trying to help!
                  so in future, try not to be such an ass.

                  "What's wrong with using include?" is a fair question to ask, yankleber. It sounds like some of us (who probably have a fair sight more experience at this thing than you) have more foresight than you. Okay, so you got an answer to the question you have right this minute. What about the next one? And the one after that? Some of us (out of some misplaced sense of duty) are keeping an eye out for you and trying to make sure you're not digging a hole for yourself. Oh, you want a bigger shovel? Here, take one.

                  [Edited instead of replied BECAUSE I CAN!!!!]

                    Originally posted by Mordecai
                    Hmm.. are you trying to get flamed?

                    Flamed? Me? Why?
                    Just because I can show people how idiot they are?

                    Let me see: the fact of some of you have thousands of posts means nothing for me, but the fact you are non-ocupped guys that can lose a lot of time just bugging other guys with stupid observations instead to try to REALLY help!

                    😃

                      And the IQ level of PHPBuilder plummets...

                        Mordecai: And the IQ level of PHPBuilder plummets...

                        It's sad... but it happens to every forum at some point.
                        There's actually a formula for it :
                        let x=the number of active posters
                        let y=number of stupid posts
                        let z=the unkown number (the IQ drop of the planet)

                        (x / y) - (z) = average IQ of posters

                        Or something like that (hey, I failed Algebra 🙂 )

                          It's the first time I've seen being spoon-fed described as "techy", and programming questions as "philosofical".

                          But okay, let's ask the question that was asked, and not get sidetracked by "philosofical aspects".

                          I would like to know if there is a way to call a PHP script from another PHP script without to use the include.

                          Is there a way to call a PHP script from another PHP script? Yes.

                          No! wait! That's wrong! That's not what was asked. If yankleber wanted to know if there was a way to call a PHP script from another PHP script then surely the post would have read "Is there a way to call a PHP script from another PHP script?" But the post didn't read that! It read:

                          I would like to know if there is a way to call a PHP script from another PHP script without to use the include.

                          Which is not a question.

                          Oooooh... I'm too stupid to help here.....

                            Wow yank, you really expect people to help you when you are a total A-hole?

                            It is my experience that when dealing with people who are asking questions about something, to find out exactly what they are trying to do, first someone may ask "How do I read files using the __ function", and the answer may be "Why use the __ function when you can use this other function?" In other words, the person asking the question usually does not fully understand what they are trying to do or the best way to go about doing it. A seasoned pro may look at the problem from a totally different point of view and offer a completely different solution than what the asker had envisioned.

                            With that said, I think Weedpacket was right in asking "What is wrong with using Include".

                              PS regarding tommynanda's solution:

                              It does dump source... if its a relative URL(like linkedfile.php)...

                              "linkedfile.php" isn't going to be a "relative URL" here. It's a (relative) filepath. Getting URLs and filepaths confused is a good way of getting into trouble: they are not the same thing.

                                Hey guys,

                                I would like to start giving my apologizes for all of you (but the ass-holes that started to offended me directly - for them, I keep thinking they are stupids). But for all other guys I would like to really sorry.

                                Let me try to explain why I was so rude.

                                I am a very straight guy, and like most of you, here, have not so much time to spent when need to solve a problem. Then, when I post a simple question, I want a simple answer, not a "philosophical" discussion about that, you know?

                                I mean that, when I ask about "an alternative to the include", I am not saying that "there is something wrong with the include". I just need to find an alternative. Fast.

                                Look, guys, I am not a stupid person. If I asking for help, and I am questioning about an "alternative to the include", is that because the include will not work to my purposes the way I need, you know?

                                Then, I think that is a loss of time to start a discussion about that. The forum objective is to help people, fast, and not to have a conference about the themes!!!!

                                And - no ofenses, please - I notice that, not just here, but in the most of forums, the "some thousand posts" guys are like, how can I say that... humm.... "gurus", that feel themselves super-genius.

                                And, for more unbelievable that it can seem, is so much more probable to get a straight and objective answer from a initiant guy in the forum than from a "some thousand posts" guy.

                                It happens just like in the College. A regular teacher is more straight and tech than a Professor or a PHD. If you ask a question to the PHD and just apply in a bad way some word, instead to focus in your question and try to understand what you really need, he will focus in the wrong word, just like "What you mean with that?".

                                Well, with a little effort - I mean little less than the effort spent to ask "what you mean with that?" - he could understand what you really mean. In fact, I guess that, in the most of time, the guys REALLY understand what you mean, but they prefer to ask you "what you mean with that?" just to tease.

                                That's why I was rude with our mate. I think that, in the deep, he understood what I meant, but maybe wanted to show his superiority over me. It was not necessary: the simple fact of he have thousand of posts against my poor participation here, already is enough to make me know that HE IS SUPERIOR. I just think that it was a bad move from him, you know? And disnecessary.

                                I know that the "some thousand posts" guys are naturally superiors, and all I need when I go to a forum is to solve some question that is bothering me, nothing more. Not to fight, not to discuss the theme in deepness, etc.

                                Just to finish, I would like to tell you that, the most of my posts here didnt gave me any solutions, because the guys complicates so much the situation, that is faster to go to Google and mine the answer there.

                                I get really sad about that, because I think that it is a straight way to the forum lose its reason to exists. 🙁

                                Just wanted to clarify.
                                Sorry if someone was offended.
                                Again, was not my intention (but, of course, that A-H that I told in the beggining!)

                                Cheers for all!

                                  I guess my first thought is where in the Hell do you get off? Do you fully understand that no one has to even answer your question? You didn't pay any money to join, you didn't do anyone any great service by posting here. So if somone is just simply trying to figure out why you are doing it a certain way so they can give you the best method of going about accomplishing what you are trying to do, you may want to try and be a little more cooperative or at least be polite. I guess I personally see your letter as a quick back peddle, in fear that you many never be helped again.

                                  Just my 2 cents!

                                    Can you see?
                                    This is what I was talking about!

                                    Everybody here is so concerned about to criticize or fight, that nobody even try to understand what the other people are talking... This is what irritates. And this is what is so inprodutive. It's like to talk in the desert, because nobody listen anyway.

                                    Ok, guys, you won! I quit.
                                    And Thanks for your (no) cooperation.

                                    By the way, I will try to unregister me in the forum, but if I cant, please there is some moderator that could ban me please????

                                    I just find out that this forum is very unusefull.

                                    Bye.

                                      Getting URLs and filepaths confused is a good way of getting into trouble: they are not the same thing.

                                      Agree with you, Weedpacket. Improper word choice I guess 😉

                                        Yan,

                                        It seems pretty clear that your grasp of the English language is not entirely complete. My guess is that you are using a translator. You want to know why people are reacting this way? Because your post was snippy and contrite. First, you tell Weedpacket that his post was "philosofical" and not TECH. In reality, he was simply trying to define the boundaries of the question, so he could help you. He is not ego-centric. He happens to be, in my opinion, one of the smartest guys on this board, and extremely helpful. He has 4 times the number of posts I have, in about the same time frame, and most of his posts actually do help people. But never mind that -- you just insult him instead of a simple "I can't use include, Weedpacket, for reasons I don't have time to go into right now."

                                        Then, you post an over-exaggerated thank you to tommynanda, with an off-handed insult to Weedpacket again. Why should anyone want to help you?

                                        The fact is, this IS a forum, a place for DISCUSSION. If you want to know TECH answers, Read The Flippin' Manual. I'm sure if you had, you would have noticed the "See Also" section that describes other commands you might consider using.

                                        When you ask a question in a forum, you are inviting discussion. It is not smart to enter a forum, only expecting people to cater to your needs, and never giving back. Conversation is a two way street.

                                        If I stopped at a gas station asking for directions to a restaurant, and the guy told me "why go there? There is a better restaurant over there that serves the same kind of food," I would be grateful. If I was meeting my mother at the restaurant, then I would simply explain that I was meeting someone there, can he tell me how to get there. If I was an asshole, and told him "none of your business, why can't you just give me simple directions like I asked, jerk?" I'm sure he'd give me directions to the nearest cliff, if he didn't flip me off and walk away.

                                        The bottom line is, if you want something from someone, and you want it for free, then try being polite instead of snide. I do not accept your apology -- and neither should anyone else here. You offended a respected member of our community, and we are glad to see you go.

                                        Good luck with your future PHP problems. It'll be tough handling them on your own.