Hello, hello i need use curl with proxy. but i get "undefined variable offset 1" error . here is the standart code i use. please help me about it thanks curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, $header); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_PROXY, $proxy); curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_REFERER, $referer); curl_setopt($ch, CURLOPT_USERAGENT, $agent);
Hi there afimafis in future could you post code using the php 'code' icon in the editor, thanks. curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, $header); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_PROXY, $proxy); curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_REFERER, $referer); curl_setopt($ch, CURLOPT_USERAGENT, $agent); PHP: Anyway back to your scenario, could you post what line your error is referring to? I think this error pops up if you haven't assigned anything to one (or more) of your references. I count six or so up there and if any of theses are not associated to anything relative to your code then they are declared 'undefined' by php. ROOFIS
thanks for answer ROOFIS the point i am sure is page can not loaded on time.even if i use timeout as 20 sn i dont know what i missed thanks
If your script is running and returns either with an error or blank it might be your proxy connectivity as this is where a lot of problems can arise especially if connecting to public ip's. You could factor in error reporting (curl_error or curl_errno) into your code to troubleshoot. ROOFIS
thanks i use aprox 50 public proxies.i test them and checked alive or not. after executing script, %99 of proxies can not load page so i belive that problem is related to proxy settings any idea ? thanks again
i dont know why but curl doesnot support any type of proxies.u know any proxy standarts curl supports ? thanks curl_setopt($ch, CURLOPT_PROXY, '119.246.25.54:3128'); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 50);
Try to set CURLOPT_PROXYTYPE for Socks OR Http proxy. What u use? I think you use Socks, then curl trying connect as Http proxy.
thanks for reply but i use http one.i detect them before running them so what might be problem ? thanks