I use the following code to send a get request to boilerpipe java web api to extract the html contents into plain text of a website,i use telerivet webhook api to send and recieve messages to my server where the php file is located,the timeout provided is 10 sec,i get timeout always with this code,please help me out
if ($_POST['secret'] !== $webhook_secret)
{
header('HTTP/1.1 403 Forbidden');
echo "Invalid webhook secret";
}
else
{
if ($_POST['event'] == 'incoming_message')
{
$content = $_POST['content'];
$from_number = $_POST['from_number'];
$phone_id = $_POST['phone_id'];
// do something with the message, e.g. send an autoreply
header("Content-Type: application/json");
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,
'http://boilerpipe-web.appspot.com/extract?url=http://www.kvgengg.com&extractor=DefaultExtractor&output=text&extractImages='
));
$content = curl_exec($ch);
echo $content;
}
}
url=http://www.kvgengg.com&extractor=DefaultExtractorIf all of that and what follows is the URL, it would need to be encoded. Ifextractor=is a different parameter in the same URL, you should encode thehttp://ww.kvgengg.com. Still that may have nothing todo with your timeout.