Results 1 to 10 of 10

Thread: PHP & wvdial

  1. #1
    Join Date
    Sep 2003
    Location
    ZA
    Posts
    24

    Question Unanswered: PHP & wvdial

    I'm working in a lazy ass department, we work off the LAN and now and again need to test queries on a dialup machine. So basically i've created a php interface to fire up wvdial on the dialup machine ( dialup machine is now also conencted on the LAN running apache ) . So with php i'm firing shell_exec('wvdial --config *configfile*'); this fires up wvdial up fine but i need the output of wvdial echoed to the browser as well. Any ideas other than us walking 10m to do this manually ?

  2. #2
    Join Date
    Jan 2004
    Location
    India
    Posts
    168
    Did u try to do something like this?
    $retval=shell_exec('wvdial --config *configfile*');
    echo "$retval";

    Am not sure but the shell_exec returns a string as output so this may work. Try this else we will try soem thing else . So please inform me about +ive or -ive whatever is the result.

    Regards
    Rajesh

  3. #3
    Join Date
    Sep 2003
    Location
    ZA
    Posts
    24

    wvdial

    thanx rajesh, but that's exactly how my php code looks ,

    <?php
    $dial = shell_exec('wvdial');
    echo $dial;
    ?>

    The page loads, looks like it's thinking about something, then blanks out. Any additional help would be greatly appreciated. Odd thing though is that things like ping & traceroute does work.

  4. #4
    Join Date
    Jan 2004
    Location
    India
    Posts
    168
    Give me some time I will get you a solution for this. I have done this before, but don't remmeber exactly how.
    Did you try doing like this
    echo "<pre>";
    $dail=system('wvdail',$retval);
    echo "</pre>";
    this useally works for command lise ls-l ... etc
    Try this and tell me... If it does not work then we will find another option.
    Regards
    Rajesh
    Last edited by rajesh_r_r; 07-01-04 at 02:43.

  5. #5
    Join Date
    Sep 2003
    Location
    ZA
    Posts
    24

    No go Hose

    <?php
    echo "<pre>";
    $dail=system('wvdial',$retval);
    echo "</pre>";
    ?>

    Unfortunately this did not work either. But i do appreciate your effors to assist. Could you possibly think of another manner to fire up the dialup connection and echo back the errors & log ?

  6. #6
    Join Date
    Jan 2004
    Location
    India
    Posts
    168
    Let me ask you some questions....
    1. What exactly you want to check on the server? (Plz elabrate)
    2. Do u have ssh access to the server?
    3. Do u have internet acccess from the server (is squid running on the server)?

    Am asking you all this b'coz to perform certain command you need certain permissions. Now th case of wvdial you cannot execute as apache (through php) you don't have the permission. So have to check for another option so Please give the answer for the above questions... so that it would be esy to help you.

    Regards
    Rajesh

  7. #7
    Join Date
    Sep 2003
    Location
    ZA
    Posts
    24
    Heh Rajesh , Let me try and clarify

    Let me ask you some questions....
    1. What exactly you want to check on the server? (Plz elabrate)
    2. Do u have ssh access to the server?
    3. Do u have internet acccess from the server (is squid running on the server)?


    We have a departmental intranet ( apache ) , we then have a dialup machine that we frequently use to performs set dialup tests, this dialup machine is also connected on the the LAN, we've set up Apache and installed the Dialup machine as well. So what i have done is set up a PHP website on the Dialup Machine which will allow us to fire up a DialUp Connection over the LAN.
    When wvdial starts i need it to echo back to the browser. Below is an example of wvdial's output.

    --> WvDial: Internet dialer version 1.53
    --> Initializing modem.
    --> Sending: ATZ
    ATZ
    OK
    --> Sending: ATQ0 V1 E1 S0=0 &C1 &D2
    ATQ0 V1 E1 S0=0 &C1 &D2
    OK
    --> Modem initialized.
    --> Sending: ATDT0,0860007249
    --> Waiting for carrier.
    ATDT0,0860007249
    CONNECT 115200/PPP 64000/NONE
    ~[7f]}#@!}$U} }&} }"]q~
    --> Carrier detected. Waiting for prompt.
    [7f]}#@!}!;} }4}"}&} } } } }#}$@#}%}&`=[0b]~}; ~
    --> PPP negotiation detected.
    --> Starting pppd at Fri Jul 2 12:30:40 2004
    --> pid of pppd: 4315

    Interestingly when going through the error log it seems that WVDIAL is being fired up, the problem seems only to be passing the baove logs through to the browser.
    Last edited by mccrack_2003; 07-02-04 at 08:00.

  8. #8
    Join Date
    Jan 2004
    Location
    India
    Posts
    168
    Let me have a look on this. I will also do this here and check the log.
    Let me ask one more thing..
    Are you checking for the connect or you want to activate the connection through wvdial.
    i have a doubt on the execute permission on the wvdial by the apache user.

    Regards
    Rajesh
    Last edited by rajesh_r_r; 07-02-04 at 08:32.

  9. #9
    Join Date
    Sep 2003
    Location
    ZA
    Posts
    24

    wvdial

    Once again thanx for all your help Rajesh.

    I'm using wvdial to connect / establish / activate the dial up connection. I have given Apache access to execute it and tests so far show that apache is firing up wvdial successfully ( tail -f /var/log/httpd/error.log shows this), the only problem now is getting wvdial's output to echo back to the browser.

    If i fire up wvdial from the comamnd line this is the output. ( below )

    --> WvDial: Internet dialer version 1.53
    --> Initializing modem.
    --> Sending: ATZ
    ATZ
    OK
    --> Sending: ATQ0 V1 E1 S0=0 &C1 &D2
    ATQ0 V1 E1 S0=0 &C1 &D2
    OK
    --> Modem initialized.
    --> Sending: ATDT0,0860007249
    --> Waiting for carrier.
    ATDT0,0860007249
    CONNECT 115200/PPP 64000/NONE
    ~[7f]}#@!}$U} }&} }"]q~
    --> Carrier detected. Waiting for prompt.
    [7f]}#@!}!;} }4}"}&} } } } }#}$@#}%}&`=[0b]~}; ~
    --> PPP negotiation detected.
    --> Starting pppd at Fri Jul 2 12:30:40 2004
    --> pid of pppd: 4315

    It's the above that i need echoed to the Browser.

    Does this answer your question ?

  10. #10
    Join Date
    Sep 2003
    Location
    ZA
    Posts
    24

    Sorted!!!!!!

    Hi Rajesh , this after all was a problem in my coding.
    What was happening is that there was an Error so the status was not 0, hence not displaying. I apologise for this oversight but thank you most kindly for your assistance.

    regards

Posting Permissions

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