Home > Backend Development > PHP Tutorial > 精通php的curl的入,有点难

精通php的curl的入,有点难

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 11:30:18
Original
896 people have browsed it

精通php的curl的进,有点难
模拟登陆织梦,版本5.7,已经去掉后台验证码,不知道为啥一直登陆不上(提示登陆成功却又跳回登陆地址)

<br /><br /><br /><?php<br />$cookie_file    =    tempnam('./temp','cookie');<br />$login_url        =    'http://localhost/dedecms/dede/login.php';<br />$post_fields    =    'gotopage=%2Fdedecms%2Fdede%2Findex.php&dopost=login&adminstyle=newdedecms&userid=admin&pwd=123456&sm1=';<br /><br />$ch = curl_init($login_url);<br />curl_setopt($ch, CURLOPT_HEADER, 0);<br />curl_setopt($ch, CURLOPT_RETURNTRANSFER,0);<br />curl_setopt($ch, CURLOPT_POST, 1);<br />curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);<br />curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);<br />curl_exec($ch);<br />curl_close($ch);<br /><br /><br />$url='http://localhost/dedecms/dede/article_add.php?channelid=1';<br />$ch = curl_init($url);<br />curl_setopt($ch, CURLOPT_HEADER, 0);<br />curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);<br />curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);<br />$contents = curl_exec($ch);<br /><br /><br />curl_close($ch);<br />?><br /><br /><br />
Copy after login


 登陆成功后要跳转到 http://localhost/dedecms/dede/article_add.php?channelid=1

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template