Google reviews feeder php code broke website












0















Hello I have this code to call google reviews. It has been working fine for long time but now is creating a 500 error anywhere is running.



<?php
$reviews = file_get_contents('https://maps.googleapis.com/json-feed');
$reviews = json_decode($reviews);
$response = '';
$class = '';
$i = 0;
$j = 1;

if(!is_object($reviews) || empty($reviews->result)) {
return $modx->parseChunk('reviews-google-pod');
}

$response .= '<div class="slides">';

// Generate the reviews
foreach($reviews->result->reviews as $review) {
if(!$i) {
$class = ' active';
}

$response .= $modx->parseChunk('review-item', array(
'reviewText' => $review->text,
'reviewer' => $review->author_name,
'date' => date('jS F Y',$review->time),
'datetime' => date('Y-m-d',$review->time),
'rating' => $review->rating,
'class' => $class,
));

$i++;
unset($class);
}

$response .= '</div>';
$response .= '<ul class="controls">';

// Generate the slider controls
foreach($reviews->result->reviews as $review) {
if($j == 1) {
$class = ' class="active"';
}

$response .= '
<li'.$class.'>
<a href="#">'.$j.'</a>
</li>
';

$j++;
unset($class);
}

$response .= '</ul>';

return $response;


It has been working fine for so long and stop working few days ago, not sure if there was a php update or something.
Any help please?



Thanks!










share|improve this question























  • There's no way we can debug this for you, you'll need to check your server logs.

    – Alex Howansky
    Jan 3 at 16:49






  • 1





    A 500 error is a generic error message and covers pretty much every single thing that can go wrong with a script. Check your server error logs to find out the exact error message.

    – aynber
    Jan 3 at 16:49











  • Have you looked at the corresponding user web page to see if the layout/format changed? Do you have a copy of the json results from a day when it was working to compare to the json currently being returned?

    – Mark Stewart
    Jan 3 at 16:49






  • 1





    file_get_contents(https://maps.googleapis.com/json-feed): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found. Checking error messages gives helpful messages. Looks like you'll need to fix the link.

    – aynber
    Jan 3 at 16:51











  • Anyber, mate the address is just to not make public the real one.

    – ysanmiguel
    Jan 4 at 11:08
















0















Hello I have this code to call google reviews. It has been working fine for long time but now is creating a 500 error anywhere is running.



<?php
$reviews = file_get_contents('https://maps.googleapis.com/json-feed');
$reviews = json_decode($reviews);
$response = '';
$class = '';
$i = 0;
$j = 1;

if(!is_object($reviews) || empty($reviews->result)) {
return $modx->parseChunk('reviews-google-pod');
}

$response .= '<div class="slides">';

// Generate the reviews
foreach($reviews->result->reviews as $review) {
if(!$i) {
$class = ' active';
}

$response .= $modx->parseChunk('review-item', array(
'reviewText' => $review->text,
'reviewer' => $review->author_name,
'date' => date('jS F Y',$review->time),
'datetime' => date('Y-m-d',$review->time),
'rating' => $review->rating,
'class' => $class,
));

$i++;
unset($class);
}

$response .= '</div>';
$response .= '<ul class="controls">';

// Generate the slider controls
foreach($reviews->result->reviews as $review) {
if($j == 1) {
$class = ' class="active"';
}

$response .= '
<li'.$class.'>
<a href="#">'.$j.'</a>
</li>
';

$j++;
unset($class);
}

$response .= '</ul>';

return $response;


It has been working fine for so long and stop working few days ago, not sure if there was a php update or something.
Any help please?



Thanks!










share|improve this question























  • There's no way we can debug this for you, you'll need to check your server logs.

    – Alex Howansky
    Jan 3 at 16:49






  • 1





    A 500 error is a generic error message and covers pretty much every single thing that can go wrong with a script. Check your server error logs to find out the exact error message.

    – aynber
    Jan 3 at 16:49











  • Have you looked at the corresponding user web page to see if the layout/format changed? Do you have a copy of the json results from a day when it was working to compare to the json currently being returned?

    – Mark Stewart
    Jan 3 at 16:49






  • 1





    file_get_contents(https://maps.googleapis.com/json-feed): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found. Checking error messages gives helpful messages. Looks like you'll need to fix the link.

    – aynber
    Jan 3 at 16:51











  • Anyber, mate the address is just to not make public the real one.

    – ysanmiguel
    Jan 4 at 11:08














0












0








0








Hello I have this code to call google reviews. It has been working fine for long time but now is creating a 500 error anywhere is running.



<?php
$reviews = file_get_contents('https://maps.googleapis.com/json-feed');
$reviews = json_decode($reviews);
$response = '';
$class = '';
$i = 0;
$j = 1;

if(!is_object($reviews) || empty($reviews->result)) {
return $modx->parseChunk('reviews-google-pod');
}

$response .= '<div class="slides">';

// Generate the reviews
foreach($reviews->result->reviews as $review) {
if(!$i) {
$class = ' active';
}

$response .= $modx->parseChunk('review-item', array(
'reviewText' => $review->text,
'reviewer' => $review->author_name,
'date' => date('jS F Y',$review->time),
'datetime' => date('Y-m-d',$review->time),
'rating' => $review->rating,
'class' => $class,
));

$i++;
unset($class);
}

$response .= '</div>';
$response .= '<ul class="controls">';

// Generate the slider controls
foreach($reviews->result->reviews as $review) {
if($j == 1) {
$class = ' class="active"';
}

$response .= '
<li'.$class.'>
<a href="#">'.$j.'</a>
</li>
';

$j++;
unset($class);
}

$response .= '</ul>';

return $response;


It has been working fine for so long and stop working few days ago, not sure if there was a php update or something.
Any help please?



Thanks!










share|improve this question














Hello I have this code to call google reviews. It has been working fine for long time but now is creating a 500 error anywhere is running.



<?php
$reviews = file_get_contents('https://maps.googleapis.com/json-feed');
$reviews = json_decode($reviews);
$response = '';
$class = '';
$i = 0;
$j = 1;

if(!is_object($reviews) || empty($reviews->result)) {
return $modx->parseChunk('reviews-google-pod');
}

$response .= '<div class="slides">';

// Generate the reviews
foreach($reviews->result->reviews as $review) {
if(!$i) {
$class = ' active';
}

$response .= $modx->parseChunk('review-item', array(
'reviewText' => $review->text,
'reviewer' => $review->author_name,
'date' => date('jS F Y',$review->time),
'datetime' => date('Y-m-d',$review->time),
'rating' => $review->rating,
'class' => $class,
));

$i++;
unset($class);
}

$response .= '</div>';
$response .= '<ul class="controls">';

// Generate the slider controls
foreach($reviews->result->reviews as $review) {
if($j == 1) {
$class = ' class="active"';
}

$response .= '
<li'.$class.'>
<a href="#">'.$j.'</a>
</li>
';

$j++;
unset($class);
}

$response .= '</ul>';

return $response;


It has been working fine for so long and stop working few days ago, not sure if there was a php update or something.
Any help please?



Thanks!







php modx modx-revolution






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 3 at 16:43









ysanmiguelysanmiguel

10112




10112













  • There's no way we can debug this for you, you'll need to check your server logs.

    – Alex Howansky
    Jan 3 at 16:49






  • 1





    A 500 error is a generic error message and covers pretty much every single thing that can go wrong with a script. Check your server error logs to find out the exact error message.

    – aynber
    Jan 3 at 16:49











  • Have you looked at the corresponding user web page to see if the layout/format changed? Do you have a copy of the json results from a day when it was working to compare to the json currently being returned?

    – Mark Stewart
    Jan 3 at 16:49






  • 1





    file_get_contents(https://maps.googleapis.com/json-feed): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found. Checking error messages gives helpful messages. Looks like you'll need to fix the link.

    – aynber
    Jan 3 at 16:51











  • Anyber, mate the address is just to not make public the real one.

    – ysanmiguel
    Jan 4 at 11:08



















  • There's no way we can debug this for you, you'll need to check your server logs.

    – Alex Howansky
    Jan 3 at 16:49






  • 1





    A 500 error is a generic error message and covers pretty much every single thing that can go wrong with a script. Check your server error logs to find out the exact error message.

    – aynber
    Jan 3 at 16:49











  • Have you looked at the corresponding user web page to see if the layout/format changed? Do you have a copy of the json results from a day when it was working to compare to the json currently being returned?

    – Mark Stewart
    Jan 3 at 16:49






  • 1





    file_get_contents(https://maps.googleapis.com/json-feed): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found. Checking error messages gives helpful messages. Looks like you'll need to fix the link.

    – aynber
    Jan 3 at 16:51











  • Anyber, mate the address is just to not make public the real one.

    – ysanmiguel
    Jan 4 at 11:08

















There's no way we can debug this for you, you'll need to check your server logs.

– Alex Howansky
Jan 3 at 16:49





There's no way we can debug this for you, you'll need to check your server logs.

– Alex Howansky
Jan 3 at 16:49




1




1





A 500 error is a generic error message and covers pretty much every single thing that can go wrong with a script. Check your server error logs to find out the exact error message.

– aynber
Jan 3 at 16:49





A 500 error is a generic error message and covers pretty much every single thing that can go wrong with a script. Check your server error logs to find out the exact error message.

– aynber
Jan 3 at 16:49













Have you looked at the corresponding user web page to see if the layout/format changed? Do you have a copy of the json results from a day when it was working to compare to the json currently being returned?

– Mark Stewart
Jan 3 at 16:49





Have you looked at the corresponding user web page to see if the layout/format changed? Do you have a copy of the json results from a day when it was working to compare to the json currently being returned?

– Mark Stewart
Jan 3 at 16:49




1




1





file_get_contents(https://maps.googleapis.com/json-feed): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found. Checking error messages gives helpful messages. Looks like you'll need to fix the link.

– aynber
Jan 3 at 16:51





file_get_contents(https://maps.googleapis.com/json-feed): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found. Checking error messages gives helpful messages. Looks like you'll need to fix the link.

– aynber
Jan 3 at 16:51













Anyber, mate the address is just to not make public the real one.

– ysanmiguel
Jan 4 at 11:08





Anyber, mate the address is just to not make public the real one.

– ysanmiguel
Jan 4 at 11:08












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54026423%2fgoogle-reviews-feeder-php-code-broke-website%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54026423%2fgoogle-reviews-feeder-php-code-broke-website%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas