Authenticate into password protected directory with php

Discussion in 'PHP' started by 3.5supersonic, Jul 6, 2010.

  1. #1
    Hi

    Im trying to access a script remotely

    script is located on a password protected directory and i tried to access it like this with a javascript in a php file

    document.location = 'http://username:password@192.168.1.1/cgi-bin/test.cgi';
    Code (markup):
    problem is when the url calls im getting a confirm box contain

    "You are about to log into the site "192.168.1.1" with the username '' "

    is there way to avoid that confirm box? or better authentication method?

    it doesnt need to be a javascript, i need a way to do this in php without having this confirm message that giving by browser.

    sorry for language errors.

    Thanks
     
    3.5supersonic, Jul 6, 2010 IP
  2. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #2
    AsHinE, Jul 6, 2010 IP
  3. 3.5supersonic

    3.5supersonic Peon

    Messages:
    128
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks AsHinE, it works fine with authentication but once i click on script button it doesnt do the job. seems it just echo page
     
    3.5supersonic, Jul 6, 2010 IP
  4. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #4
    Actually Snoopy can submit forms and fetch pages. What do you want to do with that protected script?
     
    AsHinE, Jul 6, 2010 IP
  5. 3.5supersonic

    3.5supersonic Peon

    Messages:
    128
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    3.5supersonic, Jul 6, 2010 IP
  6. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #6
    So as far as I understand you want your script to use that password change script?
    If so then you have just submit this form which can be done by Snoopy submit method.
     
    AsHinE, Jul 6, 2010 IP
  7. 3.5supersonic

    3.5supersonic Peon

    Messages:
    128
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thanks it works with submit :) can you tell me how to show output in a nice way ? snoopy returns html codes
     
    3.5supersonic, Jul 6, 2010 IP
  8. 3.5supersonic

    3.5supersonic Peon

    Messages:
    128
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    ok got it, print $snoopy->results;

    Many thanks AsHinE
     
    3.5supersonic, Jul 6, 2010 IP