Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8089433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:23:38+00:00 2026-06-05T19:23:38+00:00

I am new on this stuff and this could be a simple question, but

  • 0

I am new on this stuff and this could be a simple question, but I want to validate the APIs came from a web site.

I am a reseller for a company with my own web site. All users are registered on the main company’s website through my website which means usernames/passwords are stored with company’s web site.
Now, I have some stuff on my web site which I want to show only to the registered users. Also, I have the API’s to check username and password combination of any user which in return I get similar to the following message with the help of (file_get_contents):

If successful:

***<?xml version="1.0" ?> 
  <!DOCTYPE ValidateUser (View Source for full doctype...)> 
- <ValidateUser>
  <Customer>james</Customer> 
  <Result>Success</Result> 
  </ValidateUser>***

OR if failed, then:

***<?xml version="1.0" ?> 
  <!DOCTYPE ValidateUser (View Source for full doctype...)> 
- <ValidateUser>
  <Customer>james</Customer> 
  <Result>Failed</Result> 
  <Reason>User/Password combination unknown</Reason> 
  </ValidateUser>***

That was the situation, and I was thinking to write a PHP code with if statement which can check or validate the above message came from the API request, on basis of that I can allow or reject a user to visit that particular page on my web site.

Hope it makes sense to you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:23:40+00:00Added an answer on June 5, 2026 at 7:23 pm

    Have a look at PHP SimpleXML. Parsing should be fairly easy using that.

    Some code similar to the following should do the trick:

    $result = file_get_contents('http://www.example.com/validate?username=john&pwd=mypwdhash');
    $simpleXML = new SimpleXMLElement($result);
    
    if ($simpleXML->ValidateUser[0]->Result == "Success"){
       // success
    } else{
      // fail
    }
    

    Alternatively, you can just search for the word “success” within the XML string.

    On a side-note: Using this methodology to authenticate users is not so safe, as it involves GET requests in which you mention usernames and password hashes (I assume you do use a password hash and not the plaintext password, right?).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm very new at this, but I need to create new tables from existing
I am still new to the storyboard stuff. I spent two days debugging this
I am pretty new to this iPhone dev thing but so far I have
(This question is about the best way to temporarily and programatically keep new records
I have a fairly simple android app, it gets protobuf data from a web
This question is meant to apply to interfaces in general, but I'll use AS3/Flex
Note: A have asked this question at the Superuser community first , but since
This is probably something extremely simple but I can't get my head around it
I'm pretty new to web design (but a very experienced programmer) and I'm creating
I am new to php and SQL so this is probably an easy question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.