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 7710963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:15:23+00:00 2026-06-01T01:15:23+00:00

(I am using json with PHP) Hi i have got a url, from some

  • 0

(I am using json with PHP)

Hi i have got a url, from some web service saying:

http://www.example.com?username=$username&password=$password&fname=firstname

Now they said they i can get data with xml or json to retrieve data along with passing my username and password. And when i googled found json is better option. Now i hv done doing json and received the required data successfully.

But i can see all the javascript i hav used to fetch in view-source of page. And so is the username with password.

I am a new programmer when it comes to use json or say fetching data with REST.

Can anyone just let me know the basic idea, that will be enough for me.

  • 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-01T01:15:24+00:00Added an answer on June 1, 2026 at 1:15 am

    What you need to do then is get that URL with PHP. To do this, cURL is most commonly used:

    $parameters = array(
        'username'=>$username,
        'password'=>$password,
        'fname'=>$fname
    );
    $ch = curl_init('http://www.example.com?' . http_build_query($parameters);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $output = curl_exec($ch);
    curl_close($ch);
    echo $output;
    

    You should see the data from that URL with your code. Now, since it is JSON, we need to decode that:

    print_r(json_decode($output));
    

    You should see a PHP object, where you can access its properties as needed.

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

Sidebar

Related Questions

I'm using the combination of json_encode (PHP) and JSON.parser (Javascript from json.org) for passing
Is it possible to output specific JSON data (exported from Firefox bookmarks) using PHP.
I've got a JSON value that has been converted from a JavaScript object using
So I've got an object containing several rows from a database (using PHP). How
This piece of valid json (it has been generated using php's json_encode): {html:form is
I am using an XMLHttpRequest to POST a JSON string to PHP. The JSON
I am using PHP, jQuery, and JSON. Now I need to know how to
I have a problem using JSON and arrays. Here is my code: while($row =
I have problems returning JSON data after using Uploadify. This code works in Firefox,
I'm develping an app that makes queries on reomte databases, using Json and PHP

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.