卷曲功能无法正常工作 [英] cURL function not working
问题描述
我试图从一个网站发送大量短信..所以IM使用的API ..我已经创建了 $ sendString
变量的确切URL中使用该API ..但出于某种原因,卷曲功能没有为这个特定的URL工作...
我试着用另一种功能与此API来检查我的贷方余额和它的作品......我甚至试过手动粘贴 $ sendString
变量进入链接框,它成功了!所以我知道卷曲和API都工作,却唯独没有从网站上发出我的文字...任何想法?
//创建一个新的资源卷曲
$ CH = curl_init();//设置URL和其他适当的选项
curl_setopt($ CH,CURLOPT_URL,$ sendString);
curl_setopt($ CH,CURLOPT_HEADER,0);// URL抓取,并将它传递给浏览器
curl_exec($ CH);//关闭卷曲的资源,并释放系统资源
curl_close($ CH);
使用的 curl_setopt_array()用于解析URL结果的所有字符串
像这样的:
$ curl_handle = curl_init();
$选项=数组
(
CURLOPT_URL => $网址,
CURLOPT_HEADER =>真实的,
CURLOPT_RETURNTRANSFER =>真实的,
CURLOPT_FOLLOWLOCATION =>真实的,
CURLOPT_USERAGENT => $ browser_id
);
curl_setopt_array($ curl_handle,$选项);
$ server_output = curl_exec($ curl_handle);
curl_close($ curl_handle);后续代码var_dump($ server_output)
I'm trying to send bulk text messages from a website.. so im using an api.. i have created the $sendString
variable to the exact url to use the api.. but for some reason the cURL function is not working for this particular URL...
I tried using another function with this api to check my credit balance and it works... i even tried pasting the $sendString
variable manually into the link box and it worked! So I know that cURL and the api are both working, but just not for sending out my texts from the website... any ideas?
//Create a new cURL resource
$ch = curl_init();
//Set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "$sendString");
curl_setopt($ch, CURLOPT_HEADER, 0);
//Grab URL and pass it to the browser
curl_exec($ch);
//Close cURL resource, and free up system resources
curl_close($ch);
Use curl_setopt_array() for parse all string of url
Like this:
$curl_handle = curl_init();
$options = array
(
CURLOPT_URL=>$url,
CURLOPT_HEADER=>true,
CURLOPT_RETURNTRANSFER=>true,
CURLOPT_FOLLOWLOCATION=>true,
CURLOPT_USERAGENT=>$browser_id
);
curl_setopt_array($curl_handle,$options);
$server_output = curl_exec($curl_handle);
curl_close($curl_handle);
var_dump($server_output)
这篇关于卷曲功能无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!