简体   繁体   中英

How do I avoid 401 Unauthorized error when linking a sitefinity web service with a php website?

I am looking for help with linking the sitefinity pre-built web services to a website. The website is local, and run in php code. Below are some notes I've taken, in order to post a thread in order for someone to possibly help me.

Specs, or whatever. What I want to be done: I want to use the user.svc web service. I want to crud users. I want to use the userprofiletypesservice.svc web service. I want to get profile types based on user id or whatever. I want this to happen in php.

What I've tried: I went here (among other places). http://www.sitefinity.com/blogs/svetlayankova/posts/svetla-yankovas-blog/2011/11/01/getting_started_with_restful_services_in_sitefinity

This told me to use this url to get authentication: http://localhost:60876/sitefinity/services/security/users.svc/authenticate/ I run this in a browser, nothing happens.

I do this code in php: http://localhost:60876/Sitefinity/Services/Security/Users.svc/authenticate"); $fp = fopen("test.txt", "w");

    curl_setopt($test, CURLOPT_FILE, $fp);
    curl_setopt($test, CURLOPT_HEADER, 0);

I get this response: "IIS 8.0 Detailed Error - 401.0 - Unauthorized" as well as other stuff.

Conclusion questions:

What am I doing wrong? How do I get the cookie with authentication stuff into some php variable? Do I need to use visual studio to do this, and then link up to a web service that I build myself, that will do all the validation, and I can then just link the php into that web service? That is too redundant...

So, there is my synopsis. If anyone has some clarity to throw at me, i'd appreciate it.

You don't get a response from that address as it does not work with a get verb. Here is the most recent web service docs. You'll need to probably post to that URL and then get the response and manually create the cookie

http://docs.sitefinity.com/for-developers-work-with-web-services

Check out my good friend @timw255 I believe he has a repo to do the work for you, just make sure to give him some credit.

https://github.com/timw255/SitefinitySTS-PHP

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM