KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm betting that it'll end up being something simple ... but I can use a hand in spotting it. Problem: When I try to get the contents of a specific local URL via file_get_contents() , it comes back as an empty string '' (length=0). What I've tried: $url = 'http://localhost/bbq/index.php/company/get/id/2131/return/json'; $results = file_get_contents($url); echo'<pre>Results:<br />',var_export($results),'</pre>'; When directly visiting http://localhost/bbq/index.php/company/get/id/2131/return/json , everything echos beautifully: {"id":"2131","value":"Acme Anvil Corp."} To check myself, I tried it with $url = 'http://www.google.com' , and it worked as expected so then I tried a separate Local uri, http://localhost/?phpinfo=1 , and it also worked just fine. Question: What am I missing??? [ADDITIONAL INFO] allow_url_fopen is ON I may have just found something . As a safety measure in CODEIGNITER projects, the first line of the controller script has: if ( !defined('BASEPATH')) exit('No direct script access allowed'); Commenting it out didn't provide any improvements, but I thought it may be worth mentioning nonetheless. Also, here's a dump of the HTTP Response Header. Maybe someone can see something in there. It all seems pretty straight forward to me, but I don't really know what I should be looking for. array (size=13) 0 => string 'HTTP/1.1 200 OK' (length=15) 1 => string 'Date: Thu, 27 Dec 2012 19:58:47 GMT' (length=35) 2 => string 'Server: Apache/2.4.2 (Win64) PHP/5.4.3' (length=38) 3 => string 'X-Powered-By: PHP/5.4.3' (length=23) 4 => string 'Set-Cookie: csrf_cookie
Tags (comma-separated)
Save Edits
Cancel