Copy CodeThe code is as follows:
$cookie _jar = Tempnam ('./tmp ', ' Cookie ');
$ch = Curl_init ();
curl_setopt ($ch, Curlopt_url, ' Landing address ');
curl_setopt ($ch, Curlopt_post, 1);
$request = ' username=xxx&pwd=xxx ';
curl_setopt ($ch, Curlopt_postfields, $request);//Pass Data
curl_setopt ($ch, Curlopt_cookiejar, $cookie _jar);//Save the returned cookie information in the $cookie_jar file
curl_setopt ($ch, Curlopt_returntransfer, 1);//Set whether the returned data is automatically displayed
curl_setopt ($ch, Curlopt_header, false);//Set whether to display header information
curl_setopt ($ch, Curlopt_nobody, false);//Set whether to output page content
Curl_exec ($ch);
Curl_close ($ch); Get data after Login
$ch 2 = Curl_init ();
curl_setopt ($ch 2, Curlopt_url, ' view address ');
curl_setopt ($ch 2, Curlopt_header, false);
curl_setopt ($ch 2, Curlopt_returntransfer, 1);
curl_setopt ($ch 2, Curlopt_cookiefile, $cookie _jar);
$orders = Curl_exec ($ch 2);
Echo $orders;
Curl_close ($ch 2);//Practice proved very stable:)
?>
First in the native test, in php.ini removed the Extension=php_curl.dll front;, look at Phpinfo (), and no curl.
Checked the following document,
Copy CodeThe code is as follows:
Note to Win32 users:in order to enable the This module on a Windows environment, Libeay32.dll and Ssleay32.dll must be Presen T in your PATH.
Copy Libeay32.dll and Ssleay32.dll to System32, restart Apache, refresh Phpinfo (), and see Curl.
Reference
Copy CodeThe code is as follows:
CURL Support Enabled
CURL Information libcurl/7.16.0 openssl/0.9.8d zlib/1.2.3
The native test passes smoothly, then goes to the server to test. Originally did not install curl, had to recompile PHP.
Added a--with-curl=/usr/local/curl after the original compilation parameter.
My configuration for this time is:
Copy CodeThe code is as follows:
./configure '--prefix=/usr/local/php5 '--with-apxs2=/usr/local/apache2/bin/apxs '--with-mysql=/usr/local/mysql ' '--with-gd=/usr/local/gd '--with-zlib '--with-png '--with-jpeg-dir=/usr/local/jpeg '--with-freetype-dir=/usr/ Local/freetype '--enable-sockets '--with-iconv '--enable-mbstring '--enable-track-vars '-- Enable-force-cgi-redirect '--with-config-file-path=/usr/local/php5/etc '--with-curl=/usr/local/curl
Soon OK. Phpinfo Display
Reference
Copy CodeThe code is as follows:
CURL Support Enabled
CURL information libcurl/7.12.1 openssl/0.9.7a zlib/1.2.3 libidn/0.5.6
Feel very good:)
http://www.bkjia.com/PHPjc/324747.html www.bkjia.com true http://www.bkjia.com/PHPjc/324747.html techarticle Copy the code as follows: PHP $cookie _jar = Tempnam ('./tmp ', ' Cookie '); $ch = Curl_init (); curl_setopt ($ch, Curlopt_url, ' Landing address '); cur L_setopt ($ch, Curlopt_post, 1); $reques ...