我在stackoverflow上找到了这段代码,https: //stackoverflow.com/users/370876/peter-anselmo的代码
$url = 'http://www.targeturl.com';
$myvars = 'myvar1=' . $myvar1 . '&myvar2=' . $myvar2;
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec( $ch );
我想填写两个字段,一行可以,或者需要两行(使用 curl),我怎样才能像“if”一样测试返回的 url 是否是我想要的,然后重试(比如循环)。我知道我问