我的网址格式为http://www.domain.com:10001/api/Data.cgi?Scope=System
在该URL上是我需要解析的JSON转储。我该如何访问它?我之前使用get_file_contents
就是为什么我正在努力解决这个问题 - 第一次在URL上有一个端口。如果我可以抓住JSON并将其放在file.txt中然后解析文件,那将是最好的。
<?php
$cURL = curl_init('http://81.1.1.1');
curl_setopt($cURL, CURLOPT_PORT, 10001);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
$fp = fopen("example_homepage.txt", "w");
curl_setopt($cURL, CURLOPT_FILE, $fp);
curl_setopt($cURL, CURLOPT_HEADER, 0);
curl_exec($cURL);
curl_close($cURL);
fclose($fp);
?>
我不确定如何正确添加网址的其余部分。
答案 0 :(得分:2)
如果您不需要使用curl,使用file_get_contents可能会更容易。
Function CheckNewPara()
Clipboard$()
SendKeys "+{Left}^c", True ' copy previous character
Select Case Clipboard$()
Case "" ' if the prior character is nothing
CheckNewPara = "" ' add no space
Case Chr(13)&Chr(10), Chr(9), ")" ' if the prior character is a Lf-CR, tab or )
SendKeys "{Right}", True
CheckNewPara = "" ' add no space
Case "." ' if the prior character is a period
SendKeys "{Right}", True
Clipboard$() ' check for No.
SendKeys "+{Left 3}^c", True ' copy prior three characters
SendKeys "{Right}", True
If Clipboard$() = "No." Then
CheckNewPara = " " ' add one space after No.
Else
CheckNewPara = " " ' add two spaces after period
End If
Case "?", "!"
SendKeys "{Right}", True
CheckNewPara = " " ' add two spaces after other ends of sentence
Case Else
SendKeys "{Right}", True
CheckNewPara = " " ' add one space in the usual case
End Select
Clipboard$()
End Function
答案 1 :(得分:0)
试试这个:
{{1}}