Created
August 10, 2021 10:00
-
-
Save jamesBan/e5723d0288b7b9eebe5e8788f201dbca to your computer and use it in GitHub Desktop.
指定域名对应ip请求
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$data = []; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_RESOLVE, ['api.example.com:80:127.0.0.1']); | |
curl_setopt($ch, CURLOPT_PORT, 80); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_HEADER, false); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); | |
curl_setopt($ch, CURLOPT_URL, 'http://api.example.com/api/test/123'); | |
$response = curl_exec($ch); | |
var_dump($response); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment