php - file_get_contents with X-Auth -


मुझे file_get_contents का उपयोग करने में समस्या हो रही है, AUTH प्रमाणीकरण मेरे पास एक्स-एट टोकन है लेकिन मुझे यह निश्चित नहीं है कि यह कैसे file_get_contents में बाँधना है। इसके परिणामस्वरूप मुझे ब्राउजर में पृष्ठ का दौरा करते समय एक त्रुटि मिलती है, जिसका भाग है:

चेतावनी: स्ट्रीम खोलने में विफल: HTTP अनुरोध विफल रहा! एचटीटीपी / 1.1 401 अनधिकृत

मेरे पास कभी भी file_get_contents के साथ कई लेन-देन नहीं हुए हैं, इसे एक्स-एट के साथ प्रयोग करने में कभी भी नहीं है इसलिए मैं थोड़ी सी अटक गया हूं!

किसी भी मदद की बहुत सराहना की जाएगी।

धन्यवाद

कृपया foloowing ब्लॉग पोस्ट पढ़ें :

ब्लॉग प्रविष्टि में यह कैसे हासिल किया जा सकता है पर एक अच्छा उदाहरण है:

  $ username = 'username'; $ Password = 'password'; $ Context = stream_context_create (सरणी ('http' = & gt; सरणी ('हेडर' = & gt; "प्राधिकरण: बेसिक"। Base64_encode ("$ username: $ password")))); $ डेटा = file_get_contents ($ url, गलत, $ संदर्भ);    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -