简体   繁体   中英

cURL with PHP question for logging in to https:// remote site

So I have this cURL script for remote login. It works fine for some pages but not the pages I need.

For the page that isn't accessible through the script, the remote server requires the url be like this:

  https://sub.example.com/a/b/thisPage.aspx?aVar=%2Fa%2Fb%2Fc%2Fd%2FFile+Name.nev

It seems that cURL or just php automatically converts the last part to

  ... thisPage.aspx?aVar=/a/b/c/d/File+Name.nev

I have php echo out the url variable just before it is passed to cURL and the last part is:

  ...thisPage.aspx?aVar=%2Fa%2Fb%2Fc%2Fd%2FFile+Name.nev 

but it gives an error message "Bad Request" and the browser url shows:

  ...thisPage.aspx?aVar=/a/b/c/d/File+Name.nev

When I manually enter enter ... thisPage.aspx?aVar=%2Fa%2Fb%2Fc%2Fd%2FFile+Name.nev in my browser it pulls up the page just fine.

Try double encoding so that way the % are encoded to. Try replacing them with %25 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM