Mistři v programování na #hovnokod


Anonymous,

public function getContent($url = null)
    {
        $url = $url ? $url : $this->main_url;

        try {
            $client = new Zend_Http_Client($this->main_url);

            $client->setConfig(['timeout' => static::REQUEST_TIMEOUT]);
            $client->setCookieJar(true);
            $client->request(Zend_Http_Client::GET);
            $client->setUri($url);
            $client->request(Zend_Http_Client::GET);
            $tmp = $client->getLastResponse();

            $output = $tmp->getBody();

            return $output;
        } catch (Exception  $e) // flush and try again
        {
            flush();

            $client = new Zend_Http_Client($this->main_url);

            $client->setConfig(['timeout' => static::REQUEST_TIMEOUT]);
            $client->setCookieJar(true);
            $client->request(Zend_Http_Client::GET);
            $client->setUri($url);
            $client->request(Zend_Http_Client::GET);
            $tmp = $client->getLastResponse();

            $output = $tmp->getBody();

            return $output;
        }
    }

Fbtest Fbtester,

Náhodná 202 :)

function upload_images()
{
	global $user, $MSG, $system;

	if (!$user->logged_in)
	{
		// imitate code execution
		die(json_encode(array(
			'OK' => 0,
			'error' => array(
				'code' => '202', //random
				'message' => $MSG['login_required_text']
			)
		)));
	}
}

Ajťák Ajťák,


Anonymous,


Marek Dočekal,