hi, so it was THAT easy!
so I’ve changed this “third_party/ce_tweet/library/EpiTwitter.php” file:
private function request_basic( $method, $endpoint, $params = null, $username = null, $password = null ) { $url = $this->getApiUrl( $endpoint ); if ( $method === 'GET' ) { $url .= is_null( $params ) ? '' : '?' . http_build_query( $params, '', '&' ); } $ch = curl_init( $url ); curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Expect:' ) ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_TIMEOUT, $this->requestTimeout ); curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, $method );
// NEW LINES START HERE curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); // CURLOPT_PROXY should be set to the IP address and port of the proxy you are using instead of 12.345.67.89:12345 curl_setopt($ch, CURLOPT_PROXY, 'XXX myproxie XXX'); // Change 'username' to your username and 'password' to your password. If you don't have a username/password, your proxy might not require it and you can comment out the following line // curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'username:password'); // NEW LINES END HERE
if ( $method === 'POST' && $params !== null ) { if ( $this->isMultipart( $params ) ) { curl_setopt( $ch, CURLOPT_POSTFIELDS, $params ); } else { curl_setopt( $ch, CURLOPT_POSTFIELDS, $this->buildHttpQueryRaw( $params ) ); } } if ( !empty( $username ) && !empty( $password ) ) { curl_setopt( $ch, CURLOPT_USERPWD, "{$username}:{$password}" ); }
$resp = new EpiTwitterJson( EpiCurl::getInstance()->addCurl( $ch ), $this->debug ); if ( !$this->isAsynchronous ) { $resp->response; }
return $resp; }
and this in the “third_party/ce_tweet/library/EpiAuth.php”:
protected function curlInit( $url ) { $ch = curl_init( $url ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_HTTPHEADER, $this->headers ); curl_setopt( $ch, CURLOPT_TIMEOUT, $this->requestTimeout ); curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $this->connectionTimeout ); curl_setopt( $ch, CURLOPT_ENCODING, '' ); if ( $this->followLocation && ! ini_get( 'safe_mode' ) && ! ini_get( 'open_basedir' ) ) //safe_mode and open_basedir conditionals added by Aaron Waldon on 04-16-2012 to prevent errors on some hosts (like Engine Hosting) { curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true ); } /* Removed on 01/18/2013 by Aaron Waldon, since it was causing issues for several people if ( isset( $_SERVER [ 'SERVER_ADDR' ] ) && ! empty( $_SERVER[ 'SERVER_ADDR' ] ) && $_SERVER[ 'SERVER_ADDR' ] != '127.0.0.1' ) { curl_setopt( $ch, CURLOPT_INTERFACE, $_SERVER [ 'SERVER_ADDR' ] ); } */
// NEW LINES START HERE curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); // CURLOPT_PROXY should be set to the IP address and port of the proxy you are using instead of 12.345.67.89:12345 curl_setopt($ch, CURLOPT_PROXY, 'XXX myproxie XXX'); // Change 'username' to your username and 'password' to your password. If you don't have a username/password, your proxy might not require it and you can comment out the following line // curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'username:password'); // NEW LINES END HERE
//if the certificate exists then use it, else bypass ssl checks if ( file_exists( $cert = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'ca-bundle.crt' ) ) { curl_setopt( $ch, CURLOPT_CAINFO, $cert ); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, true ); curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 2 ); } else { curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false ); } return $ch; }
and it seems to work! OMG!
but I am not sure about the position of these new lines.
do you think they are ok there?
btw: it’s ce_tweet 1.3.6 and ExpressionEngine 2.6.1
I guess I’ll have to do the same with ce_image?
cheers and thanks a lot for pointing me into the right direction!
stefan
|