curl在php和IP地址 [英] Curl in php and IP address
本文介绍了curl在php和IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用curl连接到 http://example.net
的网址,但我需要使用IP地址连接到服务器 192.0 .43.10
。
I want to connect to the URL http://example.net
using curl, but I need to connect with server with IP adress 192.0.43.10
. How I can say to curl which IP adress it must use?
推荐答案
$c = curl_init('http://192.0.43.10/u/r/l');
curl_setopt($c, CURLOPT_HTTPHEADER, array('Host: example.net'));
curl_exec($c);
这篇关于curl在php和IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文