Retrieving IBM Watson Links "Forwarding Failed" (status_code 500)
I am sending some of the text to the IBM / Watson Relationship Retrieval Service, but I get the following response after about 90 seconds:
{"status": {"message": "Forwarding error", "status_code": 500}}
Most small files work fine and results are expected. However, this file is large (200K).
Here's my code:
set_time_limit(0);
$curl = curl_init();
$post_args = array(
'txt' => $data,
'sid' => 'ie-en-news',
'rt' => 'json'
);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_args);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_URL, "https://gateway.watsonplatform.net/relationship-extraction-beta/api/v1/sire/0");
curl_setopt($curl, CURLOPT_USERPWD, "XXXXXXXXXXXXX:XXXXXXXXXXXXX");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT ,0);
curl_setopt($curl, CURLOPT_TIMEOUT, 600);
$result = curl_exec($curl);
curl_close($curl);
$decoded = json_decode($result, true);
echo "RESPONSE: [<Br/><pre>$result</pre><br/>]";
I tried increasing the timeout values ββusing set_time_limit()
, CURLOPT_CONNECTTIMEOUT
and CURLOPT_TIMEOUT
, but it didn't matter.
+3
source to share