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
- 6 AHS
- 39 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 60 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛