cvs: php-people-web / index.php

From: Date: Fri, 05 Jun 2009 14:47:12 +0000
Subject: cvs: php-people-web / index.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-4972@lists.php.net to get a copy of this message
bjori Fri Jun 5 14:47:12 2009 UTC Modified files: /php-people-web index.php Log: Fix error conditions and use a token http://cvs.php.net/viewvc.cgi/php-people-web/index.php?r1=1.2&r2=1.3&diff_format=u Index: php-people-web/index.php diff -u php-people-web/index.php:1.2 php-people-web/index.php:1.3 --- php-people-web/index.php:1.2 Fri May 1 21:33:15 2009 +++ php-people-web/index.php Fri Jun 5 14:47:12 2009 @@ -15,13 +15,26 @@ function findPHPUser($username) { - $retval = @file_get_contents("https://master.php.net/fetch/user.php?username=" . $username); + $opts = array("ignore_errors" => true); + $ctx = stream_context_create(array("http" => $opts)); + $token = getenv("TOKEN"); + $retval = @file_get_contents("http://local.master.php.net/fetch/user.php?username=" . $username . "&token=" . rawurlencode($token), false, $ctx); if (!$retval) { - list($protocol, $errcode, $errmsg) = explode(" ", $http_response_header[0], 3); + if (isset($http_response_header) && $http_response_header) { + list($protocol, $errcode, $errmsg) = explode(" ", $http_response_header[0], 3); + } else { + $error = error_get_last(); + // Remove the function name, arguments and all that stuff... we + // really only care about whatever comes after the last colon + $message = explode(":", $error["message"]); + $errmsg = array_pop($message); + } error($errmsg); - exit; } $json = json_decode($retval, true); + if (!is_array($json)) { + error("Something happend to master"); + } if (isset($json["error"])) { error($json["error"]); }

« previous php.webmaster (#4972) next »