After searching alot and followed most of the posts, i still couldn’t resolve my problem.
Problem: file_get_contents turn & to &.
This is my code:
<?php
include ‘paths.php’;
session_start();
echo file_get_contents($solr_path.’select?q=’.urlencode($_SESSION[‘super’]).’&df=dict_word&wt=json&indent=true’);
?>
I checked the url, its working when i change & with &. I’ve tried urlencode, htmlspecialchars_decode() and http_build_query() but nothing seems to work.
I than used curl but still i can’t get the data from url on my system.
<?php
session_start();
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, $solr_path.’select?q=’.urlencode($_SESSION[‘super’]).’&df=dict_word&wt=json&indent=true’);
curl_exec ($curl);
curl_close ($curl);
?>
Than i run the code on another system webserver, both get_file_content and curl is working, giving me the data from the url. What could be the problem in my system? Both system php versions are 5.4.16.