using php to access usb port

Discussion in 'PHP' started by tresloukadu, Jan 12, 2007.

  1. #1
    hello, flks!

    I have a doubt...

    Is possible use php to access usb port on windows?

    because I spent some hours in google and I had not found anything...

    just to "com" port...

    and I tried some functions in my code like: dio_open, fopen, fwrite .... but these function run ok only with "com" (rs232) port... But usb is impossible I get errors all the time....

    I wanna access a usb port cause I have a garmin gps ... and I'm wondering catch the data send by gps with php... to store in a db... :)

    will I need some dll to solve this problem???

    I'm hoping for any suggestion... :)


    seeYa!
     
    tresloukadu, Jan 12, 2007 IP
  2. koolasia

    koolasia Banned

    Messages:
    1,413
    Likes Received:
    59
    Best Answers:
    0
    Trophy Points:
    0
    #2
    i think its not possible but u could try it using apache virtual host

    when a usb drive is attached it also gets an alphabet try to use that n see wat happens
     
    koolasia, Jan 12, 2007 IP
  3. NetworkTown.Net

    NetworkTown.Net Well-Known Member

    Messages:
    2,022
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    165
    #3
    LOL never heard of such an idea lol i dont think it would work. good luck
     
    NetworkTown.Net, Jan 12, 2007 IP
  4. streety

    streety Peon

    Messages:
    321
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It's an unusual request but I wouldn't be too surprised if it was possible.

    Even if accessing a usb post isn't possible with php directly you may be able to put something together with the exec function.
     
    streety, Jan 12, 2007 IP
  5. rgchris

    rgchris Peon

    Messages:
    187
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I remember I made a PHP script to randomly write files from a directory to my USB drive. I used the exec function and had to use a set drive letter though.
     
    rgchris, Jan 12, 2007 IP
  6. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #6
    Via PHP you can not connect/edit/delete or even view the users computer files.

    Languages like PHP/ASP/JAVA are all server side. The only way to connect to the user's computer is by using vbscripts/applets and such.

    Peace,
     
    Barti1987, Jan 12, 2007 IP
  7. streety

    streety Peon

    Messages:
    321
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #7
    azizny, I may be wrong but I think that tresloukadu was aiming to connect to a usb port on his server.
     
    streety, Jan 13, 2007 IP
  8. [*-AnOnYmOuS-*]

    [*-AnOnYmOuS-*] Active Member

    Messages:
    253
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #8
    You could do it for your own server using doemthing like fsockopen()

    where int port is your usb port
     
    [*-AnOnYmOuS-*], Jan 13, 2007 IP
  9. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #9
    My mistake, it seems like I mis-understood the original question.

    Peace,
     
    Barti1987, Jan 13, 2007 IP
  10. coderlinks

    coderlinks Peon

    Messages:
    282
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Really?

    I was under the impression that a USB port was a hardware port and not a tcpip port such as that used by fsockopen. Is it a new kind of USB (Universal Socket Bus? lol ) ;D ;)

    BTW, about the original question, the answer maybe to develop a separate program that accesses USB and call it using exec() or develop a PHP extension :)

    ~
    Thomas
     
    coderlinks, Jan 14, 2007 IP
  11. [*-AnOnYmOuS-*]

    [*-AnOnYmOuS-*] Active Member

    Messages:
    253
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #11
    Lol! Ok you got a point there coderlinks. socket() should do the trick though ;).

    ~
    Dbyt3 :p
     
    [*-AnOnYmOuS-*], Jan 16, 2007 IP
  12. sukantab

    sukantab Well-Known Member

    Messages:
    2,075
    Likes Received:
    49
    Best Answers:
    0
    Trophy Points:
    110
    #12
    And above all, if you don't mind why do you want to connect to your USB drive?
    My be the root cause can have some different solutions.
    PHP is a scripting language, not an operating system. Answer is NO-NO...
     
    sukantab, Jan 16, 2007 IP