note 58689 added to ref.curl

From: Date: Fri, 11 Nov 2005 23:49:21 +0000
Subject: note 58689 added to ref.curl
Groups: php.notes 
Request: Send a blank email to php-notes+get-98448@lists.php.net to get a copy of this message
To use proxy in cUrl, not only CURLOPT_PROXY parameter should be set but CURLOPT_HTTPPROXYTUNNEL (to 1 or true) and CURLOPT_PROXYUSERPWD (if proxy requires authorization) as it was written in the cUrl’s official documentation. Working code should be something like this: $cUrl = curl_init(); curl_setopt($cUrl, CURLOPT_URL, ‘google.com’); curl_setopt($cUrl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($cUrl, CURLOPT_HTTPPROXYTUNNEL, 1); curl_setopt($this->cUrl, CURLOPT_PROXY, 'proxy_name_or_ip:proxy_prot'); curl_setopt($this->cUrl, CURLOPT_PROXYUSERPWD, 'username:password'); $PageContent = curl_exec($cUrl); curl_close($cUrl); To be honest this code does not work on my server. Parameters’ different variation had tried but in vain, the code still did not work. Finally personal proxy server was bought and checking started again, the result was negative again. Before bringing up this question here, it was asked on many different PHP forums but in vain, nobody had the answer. There is only one suspicion: there is possibility that there is something wrong with hosting where this code was tested. To find the right answer the code should be tested in different hosting. ---- Manual Page -- http://www.php.net/manual/en/ref.curl.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58689 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58689&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58689&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58689&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58689&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58689&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58689&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58689&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58689&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#98448) next »