Use the PHP CURL library to connect the external network through the proxy server

xiaoxiao2021-03-06  71

In PHP development, sometimes it needs to be developed in the internal network. For data collection items, sometimes the server needs to connect to the Internet network to get information on the Internet network. However, if the company is online through the firewall, the general file_get_content function will not work. Of course, it is also possible to write HTTP requests to Proxy written by some socket operations, but it is more troublesome. This article discusses the simple agent implementation of the CURL library. 1. The installation of the CURL library Google can find a lot of documents for the CURL library installed, but in fact, the general Linux Installation contains the CURL library. Can we check if the PHP compilation parameters will be installed with <"phpinfo ()?> To get information on whether the CURL library is installed.

As shown below: ./ Configure '--host = i386-redhat-linux' '--build = i386-redhat-linux' '--target = i386-redhat-linux-gnu' --Program-prefix = '--prefix = / usr' '--exec-prefix = / usr' '--bindir = / usr / bin' '--sbindir = / usr / sbin' --sysconfdir = / etc "- DATADIR = / usr / share '' --includedir = / usr / include '' --Libdir = / usr / lib '' --libexecdir = / usr / libexec '' --LocalStatedir = / var '--sharedStatedir = / usr / com '--mandir = / usr / share / man' '--infodir = / usr / share / info' '--cache-file = .. / config.cache' --with-config- FILE-PATH = / etc "--with-config-file-scan-dir = / etc / php.d '' --Nable-force-cgi-redirect '' --disable-debug '--enable- Pic '' --Disable-rpath '' --Nable-inline-Optimization '' '--with-bz2' '--with-db4 = / usr' '--with-curl' --with-exec-dir = / usr / bin '' --with-freetype-dir = / usr '' --with-png-dir = / usr '' --with-gd '' --enable-gd-native-ttf '- -without-gdbm '--with-gettext' --with-ncurses' --with-gmp '--with-iconv' --with-jpeg-dir = / usr '' --with- OpenSSL '' --with-PNG '--with-pspell' '--with-regex = system' --with-xml '--with-expat-d Ir = / usr '' --with-dom = shared, / usr '' --with-dom-xslt = / usr '' --With-Dom-exSlt = / usr '' --with-xmlrpc = shared ' '--with-pcre-regex = / usr' '--with-zlib' '--With-layout = gnu' '--enable-bcmath'

'--enable-exif' --enable-ftp '' --enable-magic-quotes' --enable-sockets' '--enable-sysvsem' '--enable -sysvshm '' --enable-track-vars' '--enable-trans-sid' '--enable-yp' --enable-wddx '--with-pear = / usr / share / pear' --with-imap = shared '' --with-imap-ssl '' --with-kerberos' --with-ldap = shared '' --with-mysql = shared, / usr '' --with- Pgsql = shared '' --with-snmp = shared, / usr '--with-snmp = shared' '--enable-ucd-snmp-hack' '--with-unixodbc = shared, / usr' - -ENABLE-MEMORY-LIMIT '--enable-bcmath' '--enable-shmop' --enable-calendar '--enable-dbx' '--enable-dio' '--enable-mcal' ' --enable-mbstring '' --enable-mbstr-enc-trans '' --enable-mbregex '--with-apxs2 = / usr / sbin / apxs' 2. Access the proxy server using the CURL library

}

转载请注明原文地址:https://www.9cbs.com/read-92355.html

New Post(0)