Http://userAdmin:pwdAdmin@ip:port/ HTTP query

Http://userAdmin:pwdAdmin@ip:port/ HTTP query SearchSearch
Author Message
Marrakech
Posted on Tuesday, January 20, 2009 - 08:37 am:   

Hi Bryce,
i tray to execute http request to :
- create account
- create DList
- Add credit
-..
by using a combinaison of http://userAdmin:pwdAdmin@ip:port/

The need : process http requests from a dedicated server to nowsms.

This's an http request sample:

Warning: file_get_contents(http://userAdmin:pwdAdmin@127.0.0.1:8080/dlists?&User=custmerA&Password=cust123&DListAction=Add&DListName=Lst32_Cam p23)

userAdmin = Admin login
pwdAdmin = Admin password
User = User account
Password = Pwd account

The erreur message Is :
[function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 401 Authorization Required in


any help plz ?

Thanks
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 373
Registered: 08-2008
Posted on Tuesday, January 20, 2009 - 07:14 pm:   

Hi Marrakech,

You can simply use the "User=" and "Password=" URL parameters instead of "user:password@" in the host name part of the URL.

Not all HTTP libraries (or browsers) support the "user:password@" syntax ... this is borrowed from the FTP URL format, and is more commonly supported for FTP requests. When an HTTP library or browser does support this syntax, it builds an "Authorization:" header.

When NowSMS parses the URL request, first it looks at the "Authorization:" header. Then, if it can't find that, it looks for the "User=" and "Password=" URL parameters.

--
Des
NowSMS Support