1 <?php |
1 <?php |
2 |
2 |
3 /** |
3 /** |
4 * Deprecated. Use WP_HTTP (http.php, class-http.php) instead. |
4 * Deprecated. Use WP_HTTP (http.php) instead. |
5 */ |
5 */ |
6 _deprecated_file( basename( __FILE__ ), '3.0', WPINC . '/http.php' ); |
6 _deprecated_file( basename( __FILE__ ), '3.0.0', WPINC . '/http.php' ); |
7 |
7 |
8 if ( !class_exists( 'Snoopy' ) ) : |
8 if ( ! class_exists( 'Snoopy', false ) ) : |
9 /************************************************* |
9 /************************************************* |
10 |
10 |
11 Snoopy - the PHP net client |
11 Snoopy - the PHP net client |
12 Author: Monte Ohrt <monte@ispi.net> |
12 Author: Monte Ohrt <monte@ispi.net> |
13 Copyright (c): 1999-2008 New Digital Group, all rights reserved |
13 Copyright (c): 1999-2008 New Digital Group, all rights reserved |
997 if(!empty($body)) |
997 if(!empty($body)) |
998 $headers[] = "Content-length: ".strlen($body); |
998 $headers[] = "Content-length: ".strlen($body); |
999 if(!empty($this->user) || !empty($this->pass)) |
999 if(!empty($this->user) || !empty($this->pass)) |
1000 $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass); |
1000 $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass); |
1001 |
1001 |
1002 for($curr_header = 0; $curr_header < count($headers); $curr_header++) { |
1002 $headerfile = tempnam( $this->temp_dir, "sno" ); |
1003 $safer_header = strtr( $headers[$curr_header], "\"", " " ); |
1003 $cmdline_params = '-k -D ' . escapeshellarg( $headerfile ); |
1004 $cmdline_params .= " -H \"".$safer_header."\""; |
1004 |
1005 } |
1005 foreach ( $headers as $header ) { |
1006 |
1006 $cmdline_params .= ' -H ' . escapeshellarg( $header ); |
1007 if(!empty($body)) |
1007 } |
1008 $cmdline_params .= " -d \"$body\""; |
1008 |
1009 |
1009 if ( ! empty( $body ) ) { |
1010 if($this->read_timeout > 0) |
1010 $cmdline_params .= ' -d ' . escapeshellarg( $body ); |
1011 $cmdline_params .= " -m ".$this->read_timeout; |
1011 } |
1012 |
1012 |
1013 $headerfile = tempnam($this->temp_dir, "sno"); |
1013 if ( $this->read_timeout > 0 ) { |
1014 |
1014 $cmdline_params .= ' -m ' . escapeshellarg( $this->read_timeout ); |
1015 exec($this->curl_path." -k -D \"$headerfile\"".$cmdline_params." \"".escapeshellcmd($URI)."\"",$results,$return); |
1015 } |
|
1016 |
|
1017 |
|
1018 exec( $this->curl_path . ' ' . $cmdline_params . ' ' . escapeshellarg( $URI ), $results, $return ); |
1016 |
1019 |
1017 if($return) |
1020 if($return) |
1018 { |
1021 { |
1019 $this->error = "Error: cURL could not retrieve the document, error $return."; |
1022 $this->error = "Error: cURL could not retrieve the document, error $return."; |
1020 return false; |
1023 return false; |