可能我表达的不是很清楚,没接触过这一块
现在有需求,需要通过某个接口发送短信
请问我在PHP中该如何请求?
比如 接口为 http://interface
发送成功的话会返回200响应码,失败的话会返回400
请问我如何用PHP处理这个请求,并接受请求结果,并根据不同结果走不通流程呢?
实现如:
结果 = 请求(接口)
switch(结果)
{
case '200':
.....
case '400':
.....
}


最新回复
$f=get_headers('http://www.fenanr.com');
print_r($f);
?>
----------------------------------
Array
(
[0] => HTTP/1.1 200 OK
[1] => Connection: close
[2] => Date: Mon, 08 Sep 2008 04:07:40 GMT
[3] => Server: Microsoft-IIS/6.0
[4] => X-Powered-By: ASP.NET
[5] => X-Powered-By: PHP/4.4.4
[6] => Expires: 0
[7] => Cache-Control: private, post-check=0, pre-check=0, max-age=0
[8] => Pragma: no-cache
[9] => Set-Cookie: lec_sid=KQCv7N; expires=Mon, 15 Sep 2008 04:07:40 GMT; path=/
[10] => Set-Cookie: lec_onlineusernum=34; expires=Mon, 08 Sep 2008 04:12:40 GMT; path=/
[11] => Content-type: text/html
)
学习了..