Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CURL record works inside tests but does not work outside #348

Open
rabdavinci opened this issue Apr 26, 2021 · 1 comment
Open

CURL record works inside tests but does not work outside #348

rabdavinci opened this issue Apr 26, 2021 · 1 comment

Comments

@rabdavinci
Copy link

rabdavinci commented Apr 26, 2021

Description

CURL record works inside tests.
CURL does not work outside tests.

Environments

PHP - 7.4.3

my code

require_once __DIR__.'/vendor/autoload.php';


\VCR\VCR::configure()->setCassettePath('cassettas');
\VCR\VCR::configure()->enableLibraryHooks(['curl']);


\VCR\VCR::turnOn();
\VCR\VCR::insertCassette('example');

$url = 'http://example.com';
$ch = curl_init();
curl_setopt($ch, \CURLOPT_URL, $url);
curl_setopt($ch, \CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, \CURLOPT_POST, false);
$output = curl_exec($ch);
print_r($output);
curl_close($ch);

\VCR\VCR::eject();
\VCR\VCR::turnOff();
@Justintime50
Copy link

Can you elaborate on "does not work"? What error do you get? What do you expect to happen but doesn't?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants