Error when accessing the site

This forum is for eXpress++ general support.
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Error when accessing the site

#1 Post by Eugene Lutsenko »

On some computers, such an error occurs when accessing the site, and on some everything works fine. What could it be and how to fix it?

Code: Select all

DC_SpawnURL( 'https://aidos.byethost5.com/index.php', .T., .T. )
Attachments
MicrosoftTeams-image.png
MicrosoftTeams-image.png (65.81 KiB) Viewed 4044 times

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Error when accessing the site

#2 Post by rdonnay »

This is a simple function:

Make sure that Rundll32.exe and url.dll files exist in the SET PATH.

Code: Select all

FUNCTION DC_SpawnURL( cUrl, lBackground, lAsync )

LOCAL cParams, cCommand

DEFAULT lBackground := .F., ;
        lAsync := .t.

cParams := 'url.dll,FileProtocolHandler ' + Alltrim(cURL) // + ;
//         IIF('?'$cUrl,'','?')
cCommand := 'Rundll32.exe'

RunShell( cParams, cCommand, lAsync, lBackground )

RETURN 1
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Error when accessing the site

#3 Post by Eugene Lutsenko »

Thanks a lot, Roger! Health and well-being to you and your loved ones!

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Error when accessing the site

#4 Post by Eugene Lutsenko »

The LoadFromURL function starts the file index.php for execution or just reads it?

Code: Select all

cFile := LoadFromURL('http://aidos.byethost5.com/index.php')

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Error when accessing the site

#5 Post by rdonnay »

The LoadFromURL function starts the file index.php for execution or just reads it?
LoadFromURL will simply return the content of the index.php file as a string.

WAIT !!! Allow me to correct myself. I posted that quick answer before I had my morning coffee and walked my dog.

The response string will vary based on different factors:

1. The index.php code which will interpret the code and return a result that is displayable by a web browser. This is usually a combination of HTML and JavaScript code. This is true for CXP, PHP, ASP and other web languages.

2. The resultant HTML will be formatted so as to fit the display parameters of the client, in this case your Xbase program. This is controlled by the setting of the User Agent In LoadFromURL which defaults to Mozilla, an older web browser format. If you set the user agent to something like a Samsung phone with the Android operating system, you would get a different response.

If you want to see an example of this, call index.php from LoadFromURL.
This is code supported by the people who wrote phpBB. In order for this forum to run, I needed to install PHP, mySQL and Apache web server.
Apache is configured to automatically invoke the PHP runtime whenever a file is requested with a .PHP extension. That runtime then runs the PHP code and returns the response.

BTW - LoadFromUrl is deprecated and will not be supported in the far future. I still use it occasionally if I need a quick piece of code to access something simple. For the past 2 or 3 years I have mostly been using HttpClient() because I have much more control of the result I want.
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Error when accessing the site

#6 Post by Eugene Lutsenko »

Thank you, Roger! Are there any other functions (not DC_Spawn URL()) to launch a website for execution?

P.S. I also walk the dog in the morning and drink coffee, more precisely chicory:)

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Error when accessing the site

#7 Post by rdonnay »

Are there any other functions (not DC_Spawn URL()) to launch a website for execution?
I don't know of any.
The eXpress train is coming - and it has more cars.

k-insis
Posts: 100
Joined: Fri Jan 28, 2011 4:07 am

Re: Error when accessing the site

#8 Post by k-insis »

@Eugene:

dc_spawnurl does indeed fail (and produce error) on some machines (w10+domain+security restrictions), but there is replacement

If it is only to open certain webpage, then use sample:

//ShellOpenFile( "https://duckduckgo.com/?q=ShellExecuteA&t=h_&ia=web", .f., "open", )

//code : it was posted long ago in some forum, can't find author , thus credited to anonymous
#define SW_HIDE 0
#define SW_NORMAL 1
#define SW_SHOWMINIMIZED 2
#define SW_SHOWMAXIMIZED 3
#define SW_MAXIMIZE 3
#define SW_SHOWNOACTIVATE 4
#define SW_SHOW 5
#define SW_MINIMIZE 6
#define SW_SHOWMINNOACTIVE 7
#define SW_SHOWNA 8
#define SW_RESTORE 9
#define SW_SHOWDEFAULT 10

PROCEDURE ShellOpenFile( cFile, lHidden, cAction, cCommandLineParams )

IF ValType(cAction) == "U"
cAction := "open"
ENDIF

IF lHidden
DllCall( "SHELL32.DLL" , DLL_STDCALL, ;
"ShellExecuteA", AppDesktop():GetHWND(), cAction, cFile, ;
cCommandLineParams, CurDir(), SW_HIDE )
ELSE
DllCall( "SHELL32.DLL" , DLL_STDCALL, ;
"ShellExecuteA", AppDesktop():GetHWND(), cAction, cFile, ;
cCommandLineParams, CurDir(), SW_NORMAL )
ENDIF

RETURN



Eugene Lutsenko wrote: Mon Mar 07, 2022 11:02 pm Thank you, Roger! Are there any other functions (not DC_Spawn URL()) to launch a website for execution?

P.S. I also walk the dog in the morning and drink coffee, more precisely chicory:)

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Error when accessing the site

#9 Post by Eugene Lutsenko »

hi, k-insis! Thank you very much. I have previously reported something similar. This solution works fine on my computer. The question arises about the computers of 2% of students, of which there are several hundred. There will be classes, let's check if it works for them. DC_Spawnuri() works for all but 2% of students. I still don't understand why. They seem to have all the libraries and other files. Let's check this now, too.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Error when accessing the site

#10 Post by Eugene Lutsenko »

It turns out that this error in the DC_Spawnuri() function occurred when Windows was running under Linux. Another option with DllCall( "SHELL32.DLL" ,... works fine in this case as well.

Post Reply