Skip to content

Commit 9a94917

Browse files
committed
Generation of temporary cookies to resolve urls
1 parent 3ce7f62 commit 9a94917

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Embed/UrlResolver.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ class UrlResolver {
88
public static function resolve ($url) {
99
$connection = curl_init();
1010

11+
$tmpCookies = str_replace('//', '/', sys_get_temp_dir().'/embed-cookies.txt');
12+
1113
curl_setopt_array($connection, array(
1214
CURLOPT_URL => $url,
1315
CURLOPT_RETURNTRANSFER => true,
@@ -19,6 +21,8 @@ public static function resolve ($url) {
1921
CURLOPT_SSL_VERIFYHOST => false,
2022
CURLOPT_ENCODING => '',
2123
CURLOPT_AUTOREFERER => true,
24+
CURLOPT_COOKIEJAR => $tmpCookies,
25+
CURLOPT_COOKIEFILE => $tmpCookies,
2226
CURLOPT_USERAGENT => 'Embed PHP Library'
2327
));
2428

0 commit comments

Comments
 (0)