MantisBT - AContent
View Issue Details
0005761AContentImport/Exportpublic2017-02-23 19:012017-05-27 09:21
greg 
greg 
normalmajoralways
closedfixed 
1.4 
1.41.4 
0005761: Export from ATutor fails
When in ATutor, and attempting to export to AContent, import fails on file_get_content(), returning a file not found error (below).

https://github.com/atutor/AContent/blob/master/home/ims/ims_import.php#L808 [^]

However, manually copying the output from $_REQUEST['url'], being passed to file_get_content() in this case, and pasting it into a browser, downloads the properly zipped common cartirdge.
Requires an integrated ATutor with AContent Setup

Login to an ATutor course as its instructor.
Open a simple content page.
Turn on the Manage tools (slider button).
Click on Export Content in the Manage tabs.
In the Export Content area choose "Common Cartidge" and check Export content to the AContent repository, and press the Export button.
After being forwarded to AContent, enter your AContent author credentials and press Login.

You are then redirected back to ATutor where the error message appears.

AContent lesson import failed at:
No response from AContent. It might because the course is too big to be auto-imported into AContent, or unknown problems occurred. Please download the ATutor package and manually import into AContent. (AT_ERROR_TILE_IMPORT_FAIL)
 
 PHP Warning: file_get_contents(http://localhost/atutorgit/mods/_core/imscc/ims_export.php?cid=0&c=26&m=e1c4bd99ea3c662148b95df045ca447d [^]): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
 in /Applications/MAMP/htdocs/acontentgit/home/ims/ims_import.php on line 808
No tags attached.
Issue History
2017-02-23 19:01gregNew Issue
2017-02-23 19:13gregSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=314#r314
2017-02-23 19:13gregAdditional Information Updatedbug_revision_view_page.php?rev_id=316#r316
2017-02-23 19:14gregDescription Updatedbug_revision_view_page.php?rev_id=318#r318
2017-02-24 17:11cindyNote Added: 0007539
2017-02-24 18:42gregNote Added: 0007540
2017-02-24 18:42gregStatusnew => resolved
2017-02-24 18:42gregFixed in Version => 1.4
2017-02-24 18:42gregResolutionopen => fixed
2017-02-24 18:42gregAssigned To => greg
2017-05-27 09:21gregNote Added: 0007597
2017-05-27 09:21gregStatusresolved => closed

Notes
(0007539)
cindy   
2017-02-24 17:11   
Hi Greg, I reproduce the same issue with local ATutor and AContent. The problem is as you said with using file_get_contents() to fetch contents from localhost.

I found this stackover thread helps a lot: http://stackoverflow.com/questions/9574130/file-get-contents-failed-to-open-stream-http-request-failed-http-1-1-404-not [^]

Once I replaced the usage of "localhost" on both ATutor and AChecker to "127.0.0.1", the import works. Better also test this with ATutor and AChecker demo sites that have proper domains to make sure the issue doesn't happen there.

Another PHP setting "allow_url_fopen" must be set to on to allow file_get_contents() to fetch from a url.
(0007540)
greg   
2017-02-24 18:42   
Adjust sql for OAuth handling, there for years but stopped working.
(0007597)
greg   
2017-05-27 09:21   
Closed for AContent 1.4