2

Código sendo utilizado em um php na pasta /root:

<?php

$jsoncontent = file_get_contents('https://xx.xxx.xx.xxx/v1/API_operation');
$jsoncontent = utf8_encode($jsoncontent);
$data = json_decode($jsoncontent,true);
echo $data;

$json_errors = array(
    JSON_ERROR_NONE => 'No error has occurred',
    JSON_ERROR_DEPTH => 'The maximum stack depth has been exceeded',
    JSON_ERROR_CTRL_CHAR => 'Control character error, possibly incorrectly encoded',
    JSON_ERROR_SYNTAX => 'Syntax error',
);
 echo 'Last error : ', $json_errors[json_last_error()], PHP_EOL, PHP_EOL;

O resultado é Last error : No error has occurred, mas não exibe nenhum componente/objeto do link referente, oque posso fazer?

Quando faço var_dump($http_response_header); recebo:

array(9) { 
    [0]=> string(22) "HTTP/1.1 404 Not Found" 
    [1]=> string(25) "Server: Apache-Coyote/1.1" 
    [2]=> string(103) "X-Powered-By: Servlet 2.4; JBoss-4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)/JBossWeb-2.0" 
    [3]=> string(35) "Date: Sat, 23 May 2015 05:24:02 GMT" 
    [4]=> string(20) "Accept-Ranges: bytes" 
    [5]=> string(31) "Server: Restlet-Framework/2.0.7" 
    [6]=> string(37) "Content-Type: text/html;charset=UTF-8" 
    [7]=> string(19) "Content-Length: 439" 
    [8]=> string(17) "Connection: close"
}
7
  • O que te dá echo utf8_encode($jsoncontent);?
    – Sergio
    22/05/2015 às 5:40
  • nada..... continuar só aparecendo a msg do last error 22/05/2015 às 6:17
  • Ok, e o que dá var_dump($http_response_header); logo depois de $jsoncontent = file_get_contents('https://xx.xxx.xx.xxx/v1/API_operation');?
    – Sergio
    22/05/2015 às 7:13
  • 1
    resultado é: array(9) { [0]=> string(22) "HTTP/1.1 404 Not Found" [1]=> string(25) "Server: Apache-Coyote/1.1" [2]=> string(103) "X-Powered-By: Servlet 2.4; JBoss-4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)/JBossWeb-2.0" [3]=> string(35) "Date: Sat, 23 May 2015 05:24:02 GMT" [4]=> string(20) "Accept-Ranges: bytes" [5]=> string(31) "Server: Restlet-Framework/2.0.7" [6]=> string(37) "Content-Type: text/html;charset=UTF-8" [7]=> string(19) "Content-Length: 439" [8]=> string(17) "Connection: close" } Last error : No error has occurred 23/05/2015 às 5:27
  • @MatheusSilvaItep Talvez o problema esteja em usar o protocolo Https, você tem habilitado extension=php_openssl.dll no teu arquivo php.ini?
    – stderr
    23/05/2015 às 7:07

0

Pesquise outras perguntas com a tag .