Curl cannot be successfully simulated. curl is a problem --
$ Cookie_file = dirname (_ FILE _). '/cookie.txt ';
$ Data = 'username = Account & password = password ';
$ Curlobj = curl_init ('http: // passport.sundns.com/index.php? Client_id = sundns ');
Curl_setopt ($ curlobj, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ curlobj, CURLOPT_POST, 1 );
Curl_setopt ($ curlobj, CURLOPT_POSTFIELDS, $ data );
Curl_setopt ($ curlobj, CURLOPT_COOKIEJAR, $ cookie_file );
$ First = curl_exec ($ curlobj );
Curl_close ($ curlobj );
$ Curlobj = curl_init ('http: // www.sundns.com/member.php ');
Curl_setopt ($ curlobj, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ curlobj, CURLOPT_COOKIEFILE, $ cookie_file );
$ Output = curl_exec ($ curlobj );
Curl_close ($ curlobj );
Echo $ output;
Cookie.txt in the directory:
# Netscape HTTP Cookie File
# Http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
# HttpOnly_passport.sundns.com FALSE/FALSE 0 PHPSESSID odjcjs622gmhg5k9b2hu92m047
Mysql error:
Not Found
The requested URL/test/login. php was not found on this server.
I tried to jump to my page but reported an error. why?
Reply to discussion (solution)
I changed the writing method, but it still failed.
$ Curl = curl_init ();
$ Cookie_jar = tempnam ('d:/wamp/www/test', 'cooke ');
Curl_setopt ($ curl, CURLOPT_URL, 'http: // www.nidebook.com/do/login.php'); // login interface
Curl_setopt ($ curl, CURLOPT_POST, 1 );
$ Request = 'username = username & password = password ';
Curl_setopt ($ curl, CURLOPT_POSTFIELDS, $ request );
Curl_setopt ($ curl, CURLOPT_COOKIEJAR, $ cookie_jar );
Curl_setopt ($ curl, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ curl, CURLOPT_HEADER, false );
Curl_exec ($ curl );
Curl_close ($ curl );
$ Curl2 = curl_init ();
Curl_setopt ($ curl2, CURLOPT_URL, 'http: // www.nidebook.com/member/homepage.php'); // Personal Center
Curl_setopt ($ curl2, CURLOPT_HEADER, false );
Curl_setopt ($ curl2, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ curl2, CURLOPT_COOKIEFILE, $ cookie_jar );
$ Content = curl_exec ($ curl2 );
Echo $ content;
After the execution, log on to the user interface and check that the user does not exist. the cookie is suspected to be faulty.
Data in cookies:
# Netscape HTTP Cookie File
# Http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
Www.nidebook.com FALSE/FALSE 1461245580 USR eauxwntm % 090% 091461159180% 09 http % 3A % 2F % 2Fwww.nidebook.com % 2Fdo % 2Flogin. php
Include some form Den values of form.
Include some form Den values of form.
It turned out to be like this. thank you. nobody taught me how to solve the problem.