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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:00:57+00:00 2026-05-31T18:00:57+00:00

<?php $pro = $_GET[‘pro’]; $pro = mysql_real_escape_string($pro); $jsonurl = index.php?z=.$pro; $json = file_get_contents($jsonurl) or

  • 0
<?php
    $pro = $_GET['pro'];
    $pro = mysql_real_escape_string($pro);
    $jsonurl = "index.php?z=".$pro;
    $json = file_get_contents($jsonurl) or die('Failed'); 
        $obj = json_decode($json);
    echo $obj->{'name'}                 
?>

I’m trying to call a JSON file that is on my server, but everytime I try I get this error:

Warning: file_get_contents(index.php?z=1) [function.file-get-contents]: failed to open stream: No error in C:\wamp\www\dir\demo.php on line 5
Failed

My index file PHP:

<?php
    ob_start();
        header("Access-Control-Allow-Origin: *");
        include 'server.php';
        include 'functions.php';
        //SQL and Vars Here
        echo '<pre style="word-wrap: break-word; white-space: pre-wrap;">'.json_encode($array).'</pre>';
ob_flush();
?>
  • 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-31T18:00:58+00:00Added an answer on May 31, 2026 at 6:00 pm

    file_get_contents requires the full url. not just the file path.

    eg:

    $jsonurl = "http://www.yourwebsiteurl.co.uk/index.php?z=".$pro;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Running PHP under IIS on my Win XP Pro system. I cannot debug my
Probably really easy for a pro, but could someone re-write this from it's PHP
I'm trying to store a url such as: http://localhost/pro_print/index.php#page=home in a variable, but I
I'm using the basic example from php.net on my local machine (Macbook Pro w/
Im not a pro at PHP, just starting actually and was wondering if you
About 4 years ago I used a php product called amember pro, it is
How to integrate PHPUnit with PHP Pro custom php framework ? I need how
i use win7 + VS2008 PRO to edit my blog (php) and i can't
I had PHP 5.2.2 installed on a previous box (also WinXP Pro sp3) and
I have Eclipse PDT version 1.3.0 PHP Version 5.3.8 Running on windows XP Pro

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.