I have some code which calls a 3rd party service and returns stock/etf data. This is the error:
PHP Warning: file_get_contents(http://********.******.********.com/*************.json?apikey=********************************&symbols=FFHG,FFTI,NUDM,NUEM,GIGB,AZIA,BCHP,BRAF,BRXX,BSCF,BSJF,DBIZ,EEHB,EWRM,EWRS,GURX,INC,ITF,JUNR,LAG,MATL,MDLL,SUBD,TENZ,CU,MULT,PLTM,HYLB,SGQI,WTID,WTIU,CUMB,COMB,COMG,BVAL,PPLN,ICOW,CALF,GMFL,RNDM,RNEM,RNLC,RNMC,RNSC,RNDV,FCAL,VSMV,OCIO,TTAI,GOAU,VESH,USMF,GSSC,SMMD,IBD,PREF,FANZ,FNG,EUXL,SUSC,SUSB,IGEB,HYDB,SQLV,REEM,RGLB,REFA,SPMV,USEQ,EQRR,EMXC,USOU,USOD,DMRL,DMRM,DMRS,DMRI,EDOW,AMCA,ULBR,DLBR,EMBU,DWPP,FMDG,FFIU,FPEI,YESR,FLMI,FLMB,MFUS,MFEM,MFDX,SECT,MAGA,GHYB,OBOR,PFFD,MLQD,LLQD,IBDS,UBRT,DBRT,RBUS,RBIN,MXDU,XNTK,GSEW,PBUS,PBSM,PBDM,PBEE,PBTP,BSCR,BSJP,HTRB,DALT,PBND,NUBD,LFEQ,SCHK,CHGX,USMC,KEMQ,VGFO,DIAL,GOP,DEMS,PLCY,BERN,BRGL,SPMD,AIEQ,KGRN,MMIT,MMIN,PVAL,PMOM,LOGO,GRMY,EURZ,USHY,ULVM,USVM,UIVM,UEVM,USTB,UITB,CEY,FLAU,FLCA,FLEE,FLEH,FLFR,FLGR,FLHK,FLIY,FLIP,FLJH,FLGB,FLKR,FLBR,FLCH,FLMX,FLTW,GUDB,BIBL,RVRS,FTVA,FFSG,FFTG,FMHI,SDVY,JDIV,JMIN,JV
AL,JQUA,JMOM,ENTR,JHSC,PXUS,VTC,OMFL,OMF in ..../functions.php on line 931
It breaks after "JV", but the actual value is JVAL (you'll see the AL bit on the next line).
I have checked the database and the value that should 100% be returned is JVAL. There are no spaces in the field.
I am not sure why it is breaking at that point.
Here is the PHP function which calls the file_get_contents:
function get_etf_data($syms) {
if (is_array($syms)) {
$syms = implode(",", $syms);
}
$url = 'http://********.******.********.com/*************.json?apikey=********************************&symbols='.$syms;
//die($url); // debug
sn_bc_counter('get_etf_data',$_SERVER['REQUEST_URI']);
$data = file_get_contents($url,"r");
$data = json_decode($data);
$arr = array();
foreach ($data->results as $result) {
$arr[] = $result;
}
return $arr;
}
Any ideas to point me in the right direction?