private function getTimeStamp() { //May be used soon for encrypting futurelinks if (isset($_REQUEST['action'], $_REQUEST['hash']) && $_REQUEST['action'] == 'timestamp') { $client = new Zend\Http\Client(TikiLib::tikiUrl() . 'tiki-timestamp.php', array('timeout' => 60)); $client->getRequest()->getQuery()->set('hash', $_REQUEST['hash']); $client->getRequest()->getQuery()->set('clienttime', time()); $response = $client->send(); echo $response->getBody(); exit; } }
/** * {@inheritDoc} * @see \Zend\ServiceManager\Factory\FactoryInterface::__invoke() */ public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { $config = $container->get('config'); $clientConfig = $config['hermes']; $client = new \Zend\Http\Client($clientConfig['uri'], $clientConfig['http_client']['options']); $client->getRequest()->getHeaders()->addHeaders($clientConfig['headers']); $hermes = new Client($client, isset($clientConfig['service_name']) ? $clientConfig['service_name'] : null, $clientConfig['depth']); if (isset($clientConfig['append_path'])) { $hermes->setAppendPath($clientConfig['append_path']); } return $hermes; }
public function getCausas() { $cliente = new \Zend\Http\Client('http://civil.poderjudicial.cl', array('maxredirects' => 100, 'timeout' => 600, 'keepalive' => true)); $headers = $cliente->getRequest()->getHeaders(); $cookies = new Zend\Http\Cookies($headers); $cliente->setMethod('GET'); $response = $cliente->send(); $cliente->setUri('http://civil.poderjudicial.cl/CIVILPORWEB/AtPublicoViewAccion.do?tipoMenuATP=1'); $cookies->addCookiesFromResponse($response, $cliente->getUri()); $response = $cliente->send(); echo '<pre>'; print_r($response); echo '</pre>'; }
<?php namespace ApigilityClient; return array('aliases' => array('ApigilityClient\\Http\\Client' => 'apigility.client'), 'factories' => array('apigility.client' => function ($sm) { $config = $sm->get('config'); $clientConfig = $config['http_client']; $client = new \Zend\Http\Client($clientConfig['uri'], $clientConfig['options']); $client->getRequest()->getHeaders()->addHeaders($clientConfig['headers']); return new Http\Client($client); }), 'invokables' => array(), 'shared' => array('apigility.client' => false));
file_put_contents('php://stderr', "Failed to discover autoloader; please install dependencies and/or install via Composer.\n"); exit(1); } // Get configuration $config = getConfig(); $token = $config['token']; // Github API token $user = $config['user']; // Your user or organization $repo = $config['repo']; // The repository you're getting the changelog for $milestone = $config['milestone']; // The milestone ID $client = new Zend\Http\Client(); $client->setOptions(array('adapter' => 'Zend\\Http\\Client\\Adapter\\Curl')); $request = $client->getRequest(); $headers = $request->getHeaders(); $headers->addHeaderLine("Authorization", "token {$token}"); $client->setUri("https://api.github.com/repos/{$user}/{$repo}/milestones/{$milestone}"); $milestoneResponseBody = $client->send()->getBody(); $milestonePayload = json_decode($milestoneResponseBody, true); if (!isset($milestonePayload['title'])) { file_put_contents('php://stderr', sprintf("Provided milestone ID [%s] does not exist: %s\n", $milestone, $milestoneResponseBody)); } $client->setUri('https://api.github.com/search/issues?q=' . urlencode('milestone:' . $milestonePayload['title'] . ' repo:' . $user . '/' . $repo . ' state:closed')); $client->setMethod('GET'); $issues = array(); $error = false; do { $response = $client->send(); $json = $response->getBody();