Php file_get_contents or curl not working?

I remember I get the same result, it outputs the result and I resolve it getting the output buffer: ob_start(); // do the functions $result = ob_get_contents(); ob_end_clean() good luck edit: function getUrl($url, $params) { ob_start(); $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); curl_exec($ch); curl_close($ch); $output = ob_get_contents(); ob_end_clean(); return $output; } for example I use this function to do a post action.

I remember I get the same result, it outputs the result and I resolve it getting the output buffer: ob_start(); // do the functions $result = ob_get_contents(); ob_end_clean(); good luck edit: function getUrl($url, $params) { ob_start(); $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); curl_exec($ch); curl_close($ch); $output = ob_get_contents(); ob_end_clean(); return $output; } for example I use this function to do a post action.

– Vaibhav Gupta Aug 3 at 8:09 If you're going to do it with output buffering, use $result = ob_get_clean() instead of nesting output buffers like that. – adlawson Aug 3 at 8:10 see my edition ;) – ZiTAL Aug 3 at 8:31 @zital: I hav updated my function according to yours but getting same result... i.e. {"err":false,"msg":null} – Vaibhav Gupta Aug 3 at 8:33 please help me... – Vaibhav Gupta Aug 3 at 8:33.

If($data'http_code'! ==200) exit(json_encode(array('err'=>true, 'msg'=>'Unable to get! Error='.

$data'http_code'))); exit(json_encode(array('err'=>false, 'msg'=>json_encode(utf8_encode($data'output'))))).

You need to parse to utf8 with utf8_encode the result of curl ;) – ZiTAL Aug 3 at 10:11.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions