strange result, every time returned data changes

Hi,
I have a php script connecting to opencalais api
but sometimes it works, somtimes it shows me errors. Everytime i refrech browser (one time i get good result without errors, another time i got errors) This is so strange.
the code is about sending string content from "string array" (containing few words) to opencalais
and i will juste get topics of each word in array. Just that, it's very strange
Thanks
Best Answer
-
Hi,
As you may expect, given the same input (identical), Calais' output should be the same.
If you can a run a simple test by repeating the same request with same input we may be able to investigate further (see that maybe some of the requests timeout). In addition, if you can review your HTTP request log (F12->network tab) you may see the actual errors returned from Calais which I hope amount to timeout in which case you will have to implement retries if you must have a response or skip if the response is not crucial.
At any rate, given the error message above a "null check" on the array will help you avoid this error.
Regards.
0
Answers
-
Hello Memane,
As you justly expect seems like an easy task indeed...
So Let's try to figure out what is going wrong here:
- Please provide your php code snippet that makes the calls to the opencalais API
- Please provide a sample of error type you get in this process (if more than one kind of errors pleases provide all)
Please verify that you are providing the authentication Calais token and the rest of the header parameters as you can see from the API documentation and also from an earlier question in this forum.
At any rate, please provide 1 and 2 and we will try to resolve your issue ASAP.
Regards,
Eyal
FOR: @memane
0 -
Thanks, here are my 2 files in attachement:fcontext.zip
Everytime i refrech browser page, i get one of those 2 results (same script of course)
this one
or just this result without error:
Array
(
[0] => Politics
)0 -
Any ideas please ?
0 -
Seems like for one of your inputs you get a Null array (Array # 2)
Try adding below condition as wrapper for foreach call.
if(is_array($opencalais_result)|| is_object($opencalais_result) <br>{foreach... ...}
0 -
But, if you refrech the page in browser, you will get a good result without changing anything in script. so the probleme is not in array. Or maybe i did not understand you .
0 -
Like this?
<?php
$array1 = array("a","b","c", "d","e","f","g","h", "i","j","k","l","m", "n","o","p","q","r");
$array2 = array();
for($i=0; $i<sizeof($array1); $i++) {
if($i==0||($i+1)%6==0) {
$array2[] = $array1[$i];
}
}
print_r($array2);
?>
Prints out: Array ( [0] => a [1] => f [2] => l [3] => r )
It loops through the first array and only adds to the second array if $i=0 (the first value) or if $i is divisible by 6 with a remainder of 0. Write my Dissertation Source(s):http://www.w3schools.com/PHP/php_operato.0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 690 Datastream
- 1.4K DSS
- 629 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 255 ETA
- 559 WebSocket API
- 39 FX Venues
- 15 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 25 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 280 Open PermID
- 45 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 23 RDMS
- 2K Refinitiv Data Platform
- 717 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 106 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 96 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛