Testing with Curl proxy access, the server test is feasible, local but show blank, ask what is the situation, proxy IP is online search, available
function curl_string ($url, $user _agent, $proxy) { $ch = Curl_init (); curl_setopt ($ch, Curlopt_proxy, $proxy); curl_setopt ($ch, Curlopt_url, $url); curl_setopt ($ch, curlopt_useragent, $user _agent); curl_setopt ($ch, Curlopt_cookiejar, "C:\cookie.txt"); curl_setopt ($ch, Curlopt_header, 1); curl_setopt ($ch, Curlopt_returntransfer, 1); curl_setopt ($ch, curlopt_followlocation, 1); curl_setopt ($ch, Curlopt_timeout,); $result = curl_exec ($ch); Curl_close ($ch);
Reply to discussion (solution)
Data Send function Curl_post ($api _server, $request, $proxy = 0, $header =array ()) {$ch = Curl_init ($api _server); curl_setopt ( $ch, Curlopt_customrequest, ' POST '), if (Is_array ($header) &&!empty ($header)) {curl_setopt ($ch, Curlopt_ HEADER, 1); Set Headercurl_setopt ($ch, Curlopt_httpheader, $header);} curl_setopt ($ch, Curlopt_returntransfer, True); curl_setopt ($ch, Curlopt_postfields, $request); $request =jsonif ($proxy) {//via proxy request $api_curlopt_proxy = "Proxy IP"; curl_setopt ($ch, Curlopt_proxytype, curlproxy_http); curl_setopt ($ch, Curlopt_proxy, $API _curlopt_proxy);} $result = curl_exec ($ch), $curl _errno = Curl_errno ($ch), $curl _code = Curl_getinfo ($ch, Curlinfo_http_code); Gets the HTTP return value Curl_close ($ch), if ($curl _code = =) {return $result;} else {return FALSE;}}
There's no local agent.
Timed out when the error occurred? I've also had this kind of problem, it's time-out, and if you're wrong, I can make some suggestions.
Data Send function Curl_post ($api _server, $request, $proxy = 0, $header =array ()) {$ch = Curl_init ($api _server); curl_setopt ( $ch, Curlopt_customrequest, ' POST '), if (Is_array ($header) &&!empty ($header)) {curl_setopt ($ch, Curlopt_ HEADER, 1); Set Headercurl_setopt ($ch, Curlopt_httpheader, $header);} curl_setopt ($ch, Curlopt_returntransfer, True); curl_setopt ($ch, Curlopt_postfields, $request); $request =jsonif ($proxy) {//via proxy request $api_curlopt_proxy = "Proxy IP"; curl_setopt ($ch, Curlopt_proxytype, curlproxy_http); curl_setopt ($ch, Curlopt_proxy, $API _curlopt_proxy);} $result = curl_exec ($ch), $curl _errno = Curl_errno ($ch), $curl _code = Curl_getinfo ($ch, Curlinfo_http_code); Gets the HTTP return value Curl_close ($ch), if ($curl _code = =) {return $result;} else {return FALSE;}}
There's no local agent.
This method tests, or displays a blank
Timed out when the error occurred? I've also had this kind of problem, it's time-out, and if you're wrong, I can make some suggestions.
It's not a timeout, it's a blank execution, nothing.
111.13.109.53 Beijing Mobile
Ping does not pass
Access to the HTTP://111.13.109.53:80 report does not exist
is clearly a protected IP
Access to protected IP definitely not, this IP does not ping
Localhost:devbox lijunpeng$ ping 111.13.109.53 ping 111.13.109.53 (111.13.109.53): Data bytesrequest timeout for icmp_s EQ 0Request timeout for icmp_seq 1Request timeout for icmp_seq 2Request timeout for icmp_seq 3
111.13.109.53 Beijing Mobile
Ping does not pass
Access to the HTTP://111.13.109.53:80 report does not exist
is clearly a protected IP
This is proxy IP, used on the server is valid, can get the contents of the destination address, in the local use display blank page, get not
Access to protected IP definitely not, this IP does not ping
The visit is Baidu, that IP is proxy IP.
Proxy IP is not available how can you access Baidu according to the agent?
This IP is either an intranet IP for your server
Does local curl turn on?