[英]How to get the last url
$cookiefile = 'cookie.txt';
$params = 'page=http%3A%2F%2Fstackoverflow.com%2F&x=50&y=40';
$url='https://kproxy.com/doproxy.jsp';
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch,CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, count($params));
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0');
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
echo curl_exec($ch);
curl_close($ch);
/// at the end of the execution redirect me to this url /// ///在执行结束时,将我重定向到该网址///
https://server4.kproxy.com/servlet/redirect.srv/sruj/sfywreskebutnn/p1/ https://server4.kproxy.com/servlet/redirect.srv/sruj/sfywreskebutnn/p1/
what I want is to know how to keep the url in a data base or a txt file or save in variable sessions 我想知道的是如何将URL保留在数据库或txt文件中或保存在可变会话中
您可以按以下方式获取重定向网址:
$redirectUrl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.