• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

localhost is returning php script to AIR as a string instead of running the script

Explorer ,
Nov 18, 2021 Nov 18, 2021

Copy link to clipboard

Copied

Hi

 

I'm having this weird issue where logging into my production and test servers from my AIR desktop app works fine, but when running on localhost the php returns itself as a string to the app (it should be returning JSON).

 

The paths are set up ok, as the app's update checker, which runs first, communicates with the server fine.

 

Here's the basics of the AS3 code that has worked fine for years on the production server, adapted for localhost (_uploadObj cotain vars for post):

 

var array:Array = new Array();
array.push(_uploadObj);
var request:URLRequest = new URLRequest("http://localhost/login/login.php);
request.method = URLRequestMethod.POST;
var sendVars:URLVariables = new URLVariables();
sendVars.userData = JSON.stringify(array);
sendVars.token = _token;
request.data = sendVars;
_loader.load(request);

_loader.addEventListener(Event.COMPLETE, completeFunc);
_uploader._loader.addEventListener(IOErrorEvent.IO_ERROR, displayErrorMessage);



I have a trace set up in the first line in completeFunc(), and it traces the following:

 

<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/../pal/v1.074/login.php';

?>

 

...which is exactly what's in the login.php script that AS3 connects with.

 

Why is it returning the script instead of running it? PHP is running fine in WAMP as the site itsef loads ok in localhost.

 

Thank you

Views

91

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 18, 2021 Nov 18, 2021

Copy link to clipboard

Copied

LATEST

My post here shows I've missed a double quote in the URL, but it's not like that in the actual AS3 code, just in my botched copy/paste to here.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines