SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I provide a username and password to another site's http-auth using PHP?

    How do I provide a username and password to another site's http-auth using PHP? I want to access the del.icio.us api , but it requires http-authentication. All the info I've found is about setting up authentication on my site, not getting authenticated on someone else's.

    If this question has been addressed just reply with a link. Or have I made an incorrect basic assumption here?

    Thanks,
    Pete

  2. #2
    SitePoint Evangelist AlexC's Avatar
    Join Date
    Oct 2000
    Location
    Sheffield, UK
    Posts
    437
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you'd open the url like so

    PHP Code:
    $a fopen("http://user:pass@url.com/directory/page.html""r"); 
    Or something along those lines. Look up the function fopen
    Nearly 7 years old!

  3. #3
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I thought it only applied to ftp: but it does indeed work for http: as well. That is it would except my hosting company has allow_url_open disabled. Luckily cURL has
    PHP Code:
    curl_setopt($chCURLOPT_USERPWD"username:passwd"); 


Bookmarks

Posting Permissions

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