开发者

request page by curl

开发者 https://www.devze.com 2023-04-04 20:50 出处:网络
I wanna make process on $url address,so I use this code$ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url);

I wanna make process on $url address,so I use this code

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
echo $response;
It will do it and return response to.

I don't need to get response of page,I think it will be faster and开发者_如何学Go use less traffic. is following code can do it?

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_exec($ch);

$url is captcha maker url.


If you omit

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

response will go directly to output, connection itself works the same way, so this will not save you neither time nor traffic. But you can set CURLOPT_CUSTOMREQUEST to 'head', this way you will receive only headers of response (without html).

0

精彩评论

暂无评论...
验证码 换一张
取 消