Results 1 to 5 of 5

Thread: file_get_contents doesn't work the way i want it to!

Threaded View

  1. #1
    Join Date
    Nov 2013

    file_get_contents doesn't work the way i want it to!

    Hi all

    I want to use variables in file_get_contents but it doesn't work.

    Only example 1 works, on my host or on my own machine running lamp server. I need either example 2 or 3 to work.

    I have searched the internet, but it doesn't seem to be a problem for anyone else.

    I don't get any error messages when I use examples 2 and 3, error messages are turned on, but i dodn't get any data either.

    The data is there, pasting the url in my browser shows it.

    Many thanks for reading this.

    example 1
    PHP Code:
    $json file_get_contents("http://somesite.com/products.json;orderBy=priceAsc;pageSize=20",true); 
    example 2
    PHP Code:
    $GetURL "http://somesite.com/products.json;orderBy=priceAsc;pageSize=20"
    $json file_get_contents($GetURL,true); 
    example 3
    PHP Code:
    $OrderBy "priceAsc";
    $PageSize "20";
    $json file_get_contents("http://somesite.com/products.json;orderBy=".$OrderBy.";pageSize=".$PageSize,true); 
    Last edited by NogDog; 02-19-2014 at 10:27 AM. Reason: changed quote tags to php tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles