Skip to content

Commit e0a0436

Browse files
committed
Prepend a script to automatically add a proxy for file_get_contents etc
1 parent b3ba4fb commit e0a0436

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/interceptors/terminal-wrappers/php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ PHP_ARGS=(
1010
-d "openssl.cafile=$SSL_CERT_FILE" \
1111
# Make cURL trust us
1212
-d "curl.cainfo=$SSL_CERT_FILE" \
13+
# Prepend a script that enables the proxy
14+
-d "auto_prepend_file=`dirname $0`/prepend.php" \
1315
# Pass through all other provided arguments
1416
"$@"
1517
)

src/interceptors/terminal-wrappers/php.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ REM Remove that folder from PATH
1111
call set PATH=%%PATH:%WRAPPER_FOLDER%;=%%
1212

1313
REM Start PHP for real, with extra args to override certain configs
14-
php -d "openssl.cafile=%SSL_CERT_FILE%" -d "curl.cainfo=%SSL_CERT_FILE%" %*
14+
php -d "openssl.cafile=%SSL_CERT_FILE%" -d "curl.cainfo=%SSL_CERT_FILE%" -d "auto_prepend_file=%WRAPPER_FOLDER%\prepend.php" %*
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
stream_context_set_default(
3+
array(
4+
'http' => array('proxy' => 'localhost:8000')
5+
)
6+
);
7+
?>

0 commit comments

Comments
 (0)