Skip to content

Instantly share code, notes, and snippets.

@clemherreman
Last active December 16, 2015 14:59
Show Gist options
  • Save clemherreman/5452898 to your computer and use it in GitHub Desktop.
Save clemherreman/5452898 to your computer and use it in GitHub Desktop.
request_fulluri Composer/github bug
<?php
$options = array(
'http' => array(
'method' => 'GET',
'verify_peer' => false,
'allow_self_signed' => true,
'follow_location' => 1,
'max_redirects' => 20,
'proxy' => 'tcp://your.proxy.ip:yourProxyPort',
// Uncomment the following line to reproduce the bug
// 'request_fulluri' => 1,
'header' => array(
'1' => "Accept-Encoding: gzip",
'0' => "User-Agent: Composer/source (Windows NT; 6.1; PHP 5.3.12)",
),
),
);
$context = stream_context_create($options);
$url = 'https://api.github.com/repos/doctrine/collections/zipball/df2138bcb467533bfe6b3a01301d480aec008b93';
$data = substr(file_get_contents($url, false, $context), 0, 1000); //Truncate to avoid polluting the shell
var_dump($data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment