PxPlus User Forum

Twitter Twitter Twitter

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Mike Hatfield

Pages: 1 2 [3] 4 5
31
Programming / Re: How to remove a file from an FTP server using Curl
« on: June 11, 2019, 04:51:22 AM »
This worked!
-O or -o is needed depending on whether you want to download to other than the current folder

curl -k -ssl --user username@servername.com.au:password -o \hit\somefolder\Magento\Orders\filename.txt ftp://ftp.servername.com.au/public_html/Future/Texts/ -Q "-DELE filename.txt"

I had to be patient though.
It appeared the file wasn't deleting whilst monitoring the ftp server with Filezilla.
It just takes a while to refresh.


32
Programming / Re: How to remove a file from an FTP server using Curl
« on: June 10, 2019, 11:05:40 AM »
Removing the space certainly made a difference.
It now produces a directory listing on the command window but doesn't delete anything.
That's because the ftp url ends with /Texts/ which generates a listing.
So it seems the -Q onwards was ignored.
As you say, time to consult with curl support.
Thanks for trying.

33
Programming / Re: How to remove a file from an FTP server using Curl
« on: June 07, 2019, 08:19:04 PM »
Hi Devon,

I thought it was going to work but sadly not....
The CURL command seems to be accepted but it just hangs and eventually it times out

curl -k --ssl --user username@servername.com.au:password ftp://ftp.servername.com.au/public_html/Future/Texts/ -Q " -DELE filename.txt"

curl: (28) Timeout was reached

I don't think its the directory (0755) file permissions (0744) because curl didn't complain

34
Programming / Re: How to remove a file from an FTP server using Curl
« on: June 07, 2019, 12:14:58 AM »
Hi Devon,

I tried your suggestion

F:\HIT\TEMP\FTPFILES>curl -k --ssl -Q -DELE ftp://ftp.servername.com.au/public_html/Future/Texts/filename.txt --user username@servername.com.au:password

This is what came back

052C10398880632B4914768747600603C351BF179135309830EE638478376AFA
curl: (21) QUOT string not accepted: DELE


21 FTP quote error. A quote command returned error from the server.

35
Programming / How to remove a file from an FTP server using Curl
« on: June 05, 2019, 08:34:11 PM »
Hi All,

We have written our code to access a Magento FTP Server using CURL to download orders from a folder in json format.
To avoid processing the same orders I need to remove the file from the Magento FTP server as we process it.
That remove command structure is eluding me.
Has anyone removed a file from an FTP Server?
Thanks

36
Web Services / Re: Curl Syntax
« on: May 23, 2019, 06:14:09 PM »
Guys

Thanks for the input.
I had worked out to download the folder contents and then parse it.
I had read about the -o but didn't realise you could specify the path.
So the bit I was missing was the local path.
Thanks.

37
Web Services / Curl Syntax
« on: May 22, 2019, 09:50:00 PM »
I am trying to specifiy the folder to download a file using Curl FTP
It uses the current folder by default.
I have trawled all the online doco but I cant find the syntax to specify the local destination.

LET MPROGRAM$="""\hit\pvx\curl.exe""",MDESTINATION$="ftp://ftp.hatfields.com.au/public_html/Future/Texts/"+TT$,MUSER$=%NW_WEB_USER$+ \
             ":"+%NW_WEB_PASSWORD$

LET SS$=MPROGRAM$+" -k --ssl -O """+MDESTINATION$+""" --user """+MUSER$+"""       "
INVOKE WAIT SS$

The above becomes:


"\hit\pvx\curl.exe" -k --ssl -O "ftp://ftp.domain.com.au/public_html/Future/Texts/mytestfile.txt" --user "username:password"

1. What is the syntax to specify the destination on the local computer?
I assume it's possible because *web/ftp can do it.
Unfortunately *web/ftp won't work with the new certificate requirements on ftp server. You always get an error.
I've had that discussion before, hence using Curl. The -k and --ssl parameters overcome the certificate issue.

2. Is there a syntax to specify all eg   *.txt files on the ftp server to download.
Again I can't find that either.
I did find ranges eg   [100-200].txt but that won't work in my case because the files names could be random.
I have resorted to retrieving a file ( ?.txt ) from the ftp server folder and parsing that for individual files.
 
Thanks

38
Programming / CLEAR vs CLEAR Composite string
« on: May 15, 2019, 05:47:28 AM »
I know what CLEAR does to the program space.
I think the documentation is a bit ambiguous for CLEAR composite string
I can't see any difference in the two forms.
I interpreted CLEAR composite String to ONLY clear the Composite string but it CLEARS the stack as well

CLEAR
CLEAR MORDER${all}
Both clear the for/next/gosub stack
Is this correct?
If so, what is the point of having a separate format 2?

39
Programming / Re: Reading/parsing JSON data
« on: May 15, 2019, 03:51:17 AM »
Hi Thomas,
I wrote a loop as you described and it will loop for as long as the upper range you give it without error.
You comment is what I thought.
I guess if the field is null as opposed to blank or 0 then its at the end.
Thanks

40
Programming / Re: Reading/parsing JSON data
« on: May 15, 2019, 02:52:49 AM »
I just worked out most of this.....I make a mistake
I defined the JSON in the program as MORDER$["Order ID"]=""  etc....
then B$=DIM(LIST EDIT MORDER${all})

DIM LOAD MORDER${all}... should have been DIM LOAD B${all}...
Now
PRINT b$["Order ID"] returns 000000034

My remaining question is how to loop through the Products
There is no field containing the number of product lines EG ["Product lines"]

What would be the correct syntax to loop through the products given that any indeterminate loop will generate an error?

41
Programming / Reading/parsing JSON data
« on: May 15, 2019, 02:12:35 AM »
This is the  JSON Data file supplied

 "Order ID": "000000034",
  "Grand Total": "6",
  "Sub Total": "5.45",
  "Shipping Method": "flatrate_flatrate",
  "Shipping Description": "Order below FIS value - freight to be advised",
  "Payment Method": "Bank Transfer Payment",
  "Billing Details": {
    "City": "Springfield Lakes",
    "Street": "Brisbane",
    "Post Code": "4064",
    "Telephone": "123456789",
    "RegionCode": "Queensland"
  },
  "Shipping Details": {
    "Shipping City": "Springfield Lakes",
    "Shipping Street": "Brisbane",
    "Shipping Post Code": "4064",
    "Shipping Telephone": "123456789",
    "Shipping RegionCode": "Queensland"
  },
  "Customer Details": {
    "First Name": "Test",
    "Last Name": "Maybray",
    "Email": "test234@maybray.com",
    "IP": "144.130.97.53",
    "ID": "412"
  },
  "Products": [
    {
      "ID": "",
      "Name": "9\" x 7\" CLEAR BOOK COVER WITH COLOURED RETURNS - PACK OF 5 - BC97",
      "Type": "simple",
      "Qty": "1",
      "Price": "1.95"
    },
    {
      "ID": "",
      "Name": "SCRAPBOOK COVER - CLEAR - PACK OF 5 - SBC4934",
      "Type": "simple",
      "Qty": "1",
      "Price": "3.5"
    }
  ]
}

My Code snippet below with json as read from file.
What am I doing wrong? How do I access the fields?
My task is to parse the file and create the order in the PxPlus application order file.

  OPEN (HFN,ISZ=10240)"/hit/temp/000000034.json"
  READ RECORD (LFO,ERR=*NEXT)TEMPJSONORDER$;
  LET JSONORDER$+=TEMPJSONORDER$;
  GOTO *SAME
 !
  ESCAPE !
  DIM LOAD MORDER${ALL}=JSONORDER$
 !
  PRINT MORDER$["Order ID"]
 ! This  returns nothing at all



1}? jsonorder$
{"Order ID":"000000034","Grand Total":"6","Sub Total":"5.45","Shipping Method":"
flatrate_flatrate","Shipping Description":"Order below FIS value - freight to be
 advised","Payment Method":"Bank Transfer Payment","Billing Details":{"City":"Sp
ringfield Lakes","Street":"Brisbane","Post Code":"4064","Telephone":"123456789",
"RegionCode":"Queensland"},"Shipping Details":{"Shipping City":"Springfield Lake
s","Shipping Street":"Brisbane","Shipping Post Code":"4064","Shipping Telephone"
:"123456789","Shipping RegionCode":"Queensland"},"Customer Details":{"First Name
":"Test","Last Name":"Maybray","Email":"test234@maybray.com","IP":"144.130.97.53
","ID":"412"},"Products":[{"ID":"","Name":"9\" x 7\" CLEAR BOOK COVER WITH COLOU
RED RETURNS - PACK OF 5 - BC97","Type":"simple","Qty":"1","Price":"1.95"},{"ID":
"","Name":"SCRAPBOOK COVER - CLEAR - PACK OF 5 - SBC4934","Type":"simple","Qty":
"1","Price":"3.5"}]}
1}

1}? morder${all}
00000003465.45flatrate_flatrateOrder below FIS value - freight to be advisedBank
 Transfer PaymentSpringfield LakesBrisbane4064123456789QueenslandSpringfield Lak
esBrisbane4064123456789QueenslandTestMaybraytest234@maybray.com144.130.97.534129
" x 7" CLEAR BOOK COVER WITH COLOURED RETURNS - PACK OF 5 - BC97simple11.95SCRAP
BOOK COVER - CLEAR - PACK OF 5 - SBC4934simple13.5
1}

42
Thin Client/WindX / Re: NTHOST Service on a Windows 10 PC
« on: May 13, 2019, 09:43:11 PM »
Hi Mike K,

I'm not sure how they set up the service.
Their network support did it.
The support are also a dotnet shop so I suspect they have written a small utility to install/uninstall services.

43
Thin Client/WindX / NTHOST Service on a Windows 10 PC
« on: May 12, 2019, 11:54:35 PM »
Hi All,
We have a reseller that has a number of end users that use a Windows 10 PC as the 'server' with NTHOST running as a service.
They report that when Windows does an automatic update they have to delete the service and re-install it.
I've not had heard of this.
Is there any feedback on this issue?
Thanks

44
Programming / Re: pxplus/web/request curl -k
« on: February 19, 2019, 06:21:23 PM »
Hello Jeffrey,
I posted a request "FTPS instead of FTP or SFTP" in January.
Our hosting service has updated their ssl processing for FTP to force TLS
We were trying to use web/ftp but couldn't get it to work.
We couldn't find a way to get around the certificate processing.
The equivalent of the -k option.
In the end we built the curl string and used invoke which works perfectly.
We would have preferred to stay completely with PxPlus code.
Mike Hatfield

45
Programming / Re: Starting pxplus in Windows Task Scheduler
« on: February 17, 2019, 04:18:54 PM »
Hi Dave,

Removing the quotes worked.
Obvious solution really  :(
Thanks

Pages: 1 2 [3] 4 5