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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:40:45+00:00 2026-05-28T20:40:45+00:00

Hi guys i have been trying to use cURL to send and retrieve data.

  • 0

Hi guys i have been trying to use cURL to send and retrieve data.

I am new to php as only been doing this for about 3 weeks.

I have setup 2 variables from the database and when called from another site through cURL it should send them using json but for some reason it is not sending the data,

Could someone please tell me what i am doing wrong, everything works fine untill it gets to the json section and then it just does nothing.

code:

if(isset($_REQUEST['token'])){

$token = $_REQUEST['token'];
$url = $_REQUEST['www'];

$token = trim(htmlentities($token));
$safetoken = mysql_real_escape_string($token);
$url = trim(htmlentities($url));
$safeurl = mysql_real_escape_string($url);

$checkwebsite = "SELECT message,islive FROM websitetokens WHERE url='".$safeurl."' AND token='".$safetoken."'";
$checkwebsite_result = mysql_query($checkwebsite) OR die();
$numberofrows = mysql_num_rows($checkwebsite_result);

if($numberofrows > 0){

    $website = mysql_fetch_array($checkwebsite_result);
    $message = stripslashes($website["message"]);
    $islive = stripslashes($website["islive"]);

    json_encode(array('message' => $message,'islive' => $islive,));

    $date = date('Y-m-d');
    $time = gmdate('H:i');

    $loginwebsite = "UPDATE websitetokens SET loggedin='".$date."',time='".$time."' WHERE url='".$safeurl."' AND token='".$safetoken."'";
    $loginwebsite_result = mysql_query($loginwebsite) OR die(mysql_error());

} else {

    json_encode(array('message' => '','islive' => '1',));

}

}

Thanks

  • 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-05-28T20:40:46+00:00Added an answer on May 28, 2026 at 8:40 pm

    there will be an output if you echo the result of json_encode. Also, it may also be wise if you set the content type of the output like so:

    header("Content-Type:application/json");
    echo json_encode(array('message' => '','islive' => '1',));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, guys i have been trying to define a Stack , each node also
Hello guys, I have been trying to implement the DSUM function but failed to
Thus far you guys have been wildly helpful with me getting this little ditty
I keep on having these same two problems. I have been trying to use
I have been trying to get this to work for 12 hrs now and
I am at a loss. I have been trying to get this to work
Hey guys I have been trying different Javascript/AJAX jsf frameworks. I find most of
I've been trying to figure this out for hours. I have a DYNAMIC youtube
I have been trying to figure this little section of my larger project out
Hey guys i have a question which i have been looking for the answer

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.