invalid json string error from youtube and flickr repositories

invalid json string error from youtube and flickr repositories

by Mary Cooch -
Number of replies: 7
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

I'm testing a Moodle 2.2 that isn't online but on a local network. When I try to search for a video or image on flickr public I get the invalid json error with the messages below. I saw a similar thing in the tracker MDL-27921 but it couldn't be reproduced. It's not my problem to fix but I am curious as to what might cause it since the people whose problem it will be shall need to fix it smile

Flickr error:

Notice: unserialize(): Error at offset 0 of 24 bytes in /srv/moodle/lib/flickrlib.php on line 136
{"total":null,"perpage":null,"list":[],"repo_id":8,"issearchresult":true
youtube error:

 

Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found in
 /srv/moodle/repository/youtube/lib.php on line 102

Warning: simplexml_load_string(): couldn't connect to host in 
/srv/moodle/repository/youtube/lib.php on line 102

Warning: simplexml_load_string(): ^ in /srv/moodle/repository/youtube/lib.php on line 102

Notice: Trying to get property of non-object in /srv/moodle/repository/youtube/lib.php on line 103

Fatal error: Call to a member function children() on a non-object in 
EDIT: Oh and Wikimedia - so -basically, all the repositories I have enabled so far.
Average of ratings: -
In reply to Mary Cooch

Re: invalid json string error from youtube and flickr repositories

by Richard Price -

Hi Mary, Also getting this in our 2.2.4 Moodle.
For Youtube Repository but not for WikiMedia so far.
- Turning it off for now -pity but most users "never know it exists"

Same Stack Trace by the look from your summary.

Attachment ShowingYoutubeRepositoryErrorJSON.png
In reply to Richard Price

Re: invalid json string error from youtube and flickr repositories

by Alex Walker -

I don't know about your institutions, but in the UK most colleges and universities have proxy servers (it's a rule set by JISC, who provide internet connectivity to academic institutions). All internet traffic has to go through these proxy servers.

Moodle has settings to provide proxy settings. You'll also want to check your server's environmental settings by typing echo $http_proxy at the command line. If it shows a blank line, then another command prompt, you don't have your proxy settings set up correctly.

Contact your institution's IT or network team. They should be able to add the settings, or at least tell you what they are.

In reply to Alex Walker

Re: invalid json string error from youtube and flickr repositories

by Richard Price -

Thanks Alex! Proxy was indeed set on my server but gave me a bit of a clue to try something out. When originally set up, some individual routing was set up for our moodle server. I no longer know the exact details as was done when I ceased being the network manager but in effect it was going more or less straight to the LA. Our Moodle is in house.

echo $http_proxy gave a 10.xx.xx.xx:yyyy proxy for the server moodle is on. But Moodle / Site administration / ▶ Server / ▶ HTTP Was showing the correct address for User traffic.

User Internet goes through 172.zz.zz.zz:$$$$ Which uses a filter for internet connections. On this even with a pass all for Moodle, something must be being returned for the Youtube plugin that is not for the WikiMedia (which for some reason worked first time with either settings).

I do not know enough about the traffic routing on our Network but seems that as it passes through somewhere, perhaps the request gains some information that breaks the Youtube Plugin, but not the WikiMedia one. I rather suspect that Whether it works or not will depend on what the connection goes through. Guessing that Anyone on JISC etc (UK Schools) will have this same problem with this repository -even though that user can access Youtube without hindrance in the browser.

In Short: A commercial Internet connection with no filter is likely to work on all plugins: Cannot replicate this issue being a common Mantra. Really needs to be checked as for some reason The Youtube plugin does not play nicely with http requests using a proxy/gateway. - Even if that proxy is passing through all browser requests to Youtube...

-To Add to the confusion, This repository uses the moodle (Server/HTTP) proxy details rather than the server settings, or user's browser or system proxy settings. But on playback the file is fetched using the Users ID and access rules (for us, means that students cannot view the Youtube clip added by the teacher on moodle unless viewed at home).

Even asking a Centre's Network manager would get you a gateway or filter proxy that could still break this repository in this way given how it is behaving here.

Likely a common scenario for most Schools in the UK. Would be a good idea to get it to behave well for that scenario too, enough UK users waited long enough for a stable path from a 1.9x site to 2.x for an existing site. I will see if can get any more information but if such things are able to work in UK Schools it is less of a reason for average or less technical schools to reach immediately for the amphibious one.

In reply to Richard Price

Re: invalid json string error from youtube and flickr repositories

by rupamoy bhattacharya -

I'm also facing the same error of JSON String error in moodle 2.5.1 but not getting any solution for the same. Error details and screen-shot as follows .. can anyone help me regarding this ...

 

 

Attachment Capture.JPG
In reply to rupamoy bhattacharya

Re: invalid json string error from youtube and flickr repositories

by Tom Litchfield -

We're getting the exact same error on Moodle 2.5.2. Our instance is on a shared web host (Bluehost).

We've instructed out staff not to use this feature and instead post videos using embed code.

In reply to Tom Litchfield

Re: invalid json string error from youtube and flickr repositories

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Just pasting in comments from the network manager of my old school who resolved this issue - in case it helps future users who get to here:

 

In short simple terms.

In Moodle – Server Admin – Server – Http – remove any entries to proxy server or username and password.

Then you need to get your service provider to allow the Moodle Site through the proxy without authentication. If you are using an older proxy such as Microsoft ISA then you need to set a rule which does the same thing. It transpired that it was authentication side that was causing the error.

Geoff Diggles

Network Manager

Our Lady’s Catholic High School

Average of ratings: Useful (1)