Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Curl使用Curl\u getinfo获取url_Php_Curl - Fatal编程技术网

Php Curl使用Curl\u getinfo获取url

Php Curl使用Curl\u getinfo获取url,php,curl,Php,Curl,嗨,我知道这是关于StackOverFlow的一个非常常见的话题。我已经花了整整一周的时间去寻找它 例如,我有一个url: 发布后我要获取的此url: 但现在我明白了 我使用$lastUrl=curl\u getinfo($ch,CURLINFO\u EFFECTIVE\u URL) 我怎样才能得到“ " ? 请帮帮我谢谢你 这是我的密码: $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIESESSION, 1); curl_setopt($

嗨,我知道这是关于StackOverFlow的一个非常常见的话题。我已经花了整整一周的时间去寻找它

例如,我有一个url:

发布后我要获取的此url:

但现在我明白了

我使用
$lastUrl=curl\u getinfo($ch,CURLINFO\u EFFECTIVE\u URL)

我怎样才能得到“ " ?

请帮帮我谢谢你

这是我的密码:

$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIESESSION, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookie.txt');
curl_setopt($ch, CURLOPT_USERAGENT, "Automatic SMF poster thing");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "user=".$user."&passwrd=".$password);
curl_setopt($ch, CURLOPT_URL, "$domain?action=login2");
curl_exec($ch);
curl_setopt($ch, CURLOPT_URL, "$domain?action=post;board=".$board.".0");
$data = curl_exec($ch);
sleep(3);
preg_match('/name="([^"]+)" value="([^"]{32})"/',$data,$sc);
preg_match ( "<input type=\"hidden\" name=\"seqnum\" value=\"(.*)\">", $data, $seqnum);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "topic=".$topic."&subject=".urlencode($subj)."&icon=xx&sel_face=&sel_size=&sel_color=&message=".urlencode($mess)."&message_mode=0&notify=0&lock=0&post_vv[q][4]=๔&post_vv[q][3]=๒&post_vv[q][1]=๔&post_vv[q][2]=๒&additional_options=0&post=xxxxx&".$sc[1]."=".$sc[2]."&seqnum=4&seqnum=".$seqnum[1]);
curl_setopt($ch, CURLOPT_URL, "$domain?action=post2;start=0;board=".$board);
curl_exec($ch);
 $lastUrl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
 echo $lastUrl; // output "http://bayja.com/forum/index.php?board2" 
 curl_close($ch);
$ch=curl_init();
curl_setopt($ch,CURLOPT_COOKIESESSION,1);
curl_setopt($ch,CURLOPT_COOKIEJAR,dirname(_文件).'/cookie.txt');
curl_setopt($ch,CURLOPT_COOKIEFILE,dirname(uuu FILE_uu)。'/cookie.txt');
curl_setopt($ch,CURLOPT_USERAGENT,“自动SMF海报”);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch,CURLOPT_头,1);
卷曲设置($ch,卷曲设置桩,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,“user=”.$user.&passwrd=“.$password”);
curl_setopt($ch,CURLOPT_URL,“$domain?action=login2”);
curl_exec($ch);
curl_setopt($ch,CURLOPT_URL,$domain?action=post;board=“.board.”.0”);
$data=curl\u exec($ch);
睡眠(3);
preg_match('/name=“([^“]+)”value=“([^“]{32})”/”,$data,$sc);
preg_匹配(“,$data,$seqnum);
卷曲设置($ch,卷曲设置桩,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,“topic=”.$topic.”subject=“.urlencode($subc)。“&icon=xx&sel_face=&sel_size=&sel_color=&message=”.urlencode($mess)。“&message_mode=0¬ify=0&lock=0&post_vv[q][4]=๔&邮递服务[q][3]=๒&邮递服务[q][1]=๔&邮递服务[q][2]=๒&附加选项=0&post=xxxxx&“$sc[1]”。“=”$sc[2]”。&seqnum=4&seqnum=“..$seqnum[1]);
curl_setopt($ch,CURLOPT_URL,“$domain?action=post2;start=0;board=“.board”);
curl_exec($ch);
$lastUrl=curl\u getinfo($ch,CURLINFO\u有效\u URL);
echo$lastUrl;//输出“http://bayja.com/forum/index.php?board2" 
卷曲关闭($ch);

您有什么解决方案吗?您有什么解决方案吗?