Skip to main content

Max length for a cPanel session URL call?

Comments

8 comments

  • cPanelMichael
    Hello, Could you provide an example of the type of URL you are attempting to use? What's making the length longer than expected? Thank you.
    0
  • Svintaj
    Yes of course. I am programmatically setting up Email filters, and the output string looks like this example, where I'm blocking three IP-adresses:
    https://server.provider.com:2083/cpsessXXXXXXXXXX/execute/Email/store_filter?filtername=Test15&action1=fail "We identified your mail as SPAM."&match1=contains&part1=$message_headers&val1='333.333.333.333'&opt1=or&match2=contains&part2=$message_headers&val2='444.444.444.444'&opt2=or&match3=contains&part3=$message_headers&val3='555.555.555.555'&opt3=or
    But what if I like to block many more IPs say 50+? For each new IP to block I need to add this to the string:
    &match4=contains&part4=$message_headers&val4='777.777.777.777'&opt4=or
    So my program need to know how many more IPs it can add to that string, and if it maybe need create another Email filter to make room for the remaining IPs.
    0
  • cPanelMichael
    This is more of a limitation with the web browser from what I understand. There's a thread on StackOverflow where this topic is discussed: What is the maximum length of a URL in different browsers? Have you considered developing a custom script instead of utilizing a URL string? Thank you.
    0
  • Svintaj
    Ok thanks for the info and the informative link. So the safe limit for a URL string between browsers is about ~2000 chars, that's ok I can then block ~25 IPs per Email filter. I'm almost done now so I may be happy with this, even if it would have been nice to block more IPs per filter. However, am I even 'allowed' to run a Custom Script as an 'WebsiteOwner' I don't have a server myself? And if so how is it done? I know C, a bit C++ and some minor PHP. My program now is a Windows-application, where I just input a fresh cPanel-access code and a bunch of annoying"spam mails" and my app then builds the URL-string and 'runs' it in a browser to block them all.
    0
  • cPanelMichael
    Yes, UAPI functions are available to individual cPanel users. You authenticate with the cPanel account username/password, as documented at: Guide to API Authentication - Software Development Kit - cPanel Documentation Thank you.
    0
  • Svintaj
    Interesting, is there a good "hello world"-tutorial somewhere? I have really no idea from where I "run" a custom cPanel script, or where to save it?
    0
  • cPanelMichael
    Hello, You can search for "UAPI" on our forums to see examples. The following thread is a good place to start: PHP Client Class without WHM Thank you.
    0
  • Svintaj
    Thank you for all help, I'll take a look at it!
    0

Please sign in to leave a comment.