Re: [PHP] Form Post to different domain
On Feb 14, 2012, at 1:39 PM, Daniel Brown wrote: On Tue, Feb 14, 2012 at 13:36, Rick Dwyer rpdw...@earthlink.net wrote: I only have access to domain B... the one receiving the Form POST. Then all you should need to do is: a.) Verify that Domain A is indeed pointing to Domain B, to the script you expect, as a POST request. b.) In the POST-receiving script on Domain B, try this simple snippet: ?php echo 'pre'.PHP_EOL; var_dump($_POST); die('/pre'); ? That should give you all data from the post request. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ Why the '.PHP_EOL' ? I've never seen that before and looking through the PHP documentation doesn't give me much. Cheers, tedd _ t...@sperling.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Post to different domain
On Thu, Feb 16, 2012 at 09:53, Tedd Sperling tedd.sperl...@gmail.com wrote: Why the '.PHP_EOL' ? I've never seen that before and looking through the PHP documentation doesn't give me much. Cross-compatibility. For systems which use \n, PHP_EOL will be \n. For systems which use \r\n, PHP_EOL will be \r\n. And, for oddball or legacy systems which still use \r you get the point. This means you can rest assured that the newlines will be appropriate for the system on which PHP is running. While it makes little difference on the web, it makes a world of difference at the CLI and when writing to plain-text files (including CSV). I've been using it out of the force of habit for about seven years or so, and exclusively (with the exception of email headers and other warranted cases) for the last four. There are a lot of other very useful and yet very underused constants. You can find the info on them here: http://php.net/reserved.constants -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Post to different domain
On Thu, Feb 16, 2012 at 4:09 PM, Daniel Brown danbr...@php.net wrote: On Thu, Feb 16, 2012 at 09:53, Tedd Sperling tedd.sperl...@gmail.com wrote: This means you can rest assured that the newlines will be appropriate for the system on which PHP is running. While it makes little difference on the web, it makes a world of difference at the CLI and when writing to plain-text files (including CSV). I've been using it out of the force of habit for about seven years or so, and exclusively (with the exception of email headers and other warranted cases) for the last four. What if the system PHP is running on not the same one as the one that is going to read the plain-text/CSV/.. files? I don't think it is good practice to use it when writing to files. I often write files on a Linux server that people are going to read on a Windows PC. Apart from that, most software written in the last 5-10 years will happily read files with either \n or \r\n line endings. I'm not really sure about Win XP for example, but if it would have a problem with the Linux \n endings, it might even be better to *always* use \r\n line endings (except where standards require it), as I haven't seen a single Linux application since I started using it (about 9 years ago) that was not able to read a file with \r\n based line endings. Even better, go Unicode. Unicode specifies that there are 8 ways to make a new line, and they should all be accepted. However, the pretty uncommon NEL, LS and PS are not supported in many applications. (though CR, LF and CRLF are). - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Post to different domain
On Thu, Feb 16, 2012 at 10:57, Matijn Woudt tijn...@gmail.com wrote: What if the system PHP is running on not the same one as the one that is going to read the plain-text/CSV/.. files? I don't think it is good practice to use it when writing to files. I often write files on a Linux server that people are going to read on a Windows PC. Then what is the difference between PHP_EOL and forcing \n? It's still going to use POSIX-style EOLs, but now you've taken away the benefit of the compatibility. Apart from that, most software written in the last 5-10 years will happily read files with either \n or \r\n line endings. I'm not really sure about Win XP for example, but if it would have a problem with the Linux \n endings, it might even be better to *always* use \r\n line endings (except where standards require it), as I haven't seen a single Linux application since I started using it (about 9 years ago) that was not able to read a file with \r\n based line endings. You may want to check again. Ever see ^M at the end of your lines? Or, in vim, notice how it says it's a DOS file? Even better, go Unicode. Unicode specifies that there are 8 ways to make a new line, and they should all be accepted. However, the pretty uncommon NEL, LS and PS are not supported in many applications. (though CR, LF and CRLF are). Nothing you've suggested is necessarily bad, but more to the point, it doesn't come close to invalidating the benefit of PHP_EOL. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Post to different domain
On Thu, Feb 16, 2012 at 5:02 PM, Daniel Brown danbr...@php.net wrote: On Thu, Feb 16, 2012 at 10:57, Matijn Woudt tijn...@gmail.com wrote: What if the system PHP is running on not the same one as the one that is going to read the plain-text/CSV/.. files? I don't think it is good practice to use it when writing to files. I often write files on a Linux server that people are going to read on a Windows PC. Then what is the difference between PHP_EOL and forcing \n? It's still going to use POSIX-style EOLs, but now you've taken away the benefit of the compatibility. I'm not saying you should force \n then, but you might want to decide what to force depending on who will be using it, so in case a windows user is going to read it, then you set \r\n, otherwise you select \n.You could even try to detect that based on a browser identification string. Apart from that, most software written in the last 5-10 years will happily read files with either \n or \r\n line endings. I'm not really sure about Win XP for example, but if it would have a problem with the Linux \n endings, it might even be better to *always* use \r\n line endings (except where standards require it), as I haven't seen a single Linux application since I started using it (about 9 years ago) that was not able to read a file with \r\n based line endings. You may want to check again. Ever see ^M at the end of your lines? Or, in vim, notice how it says it's a DOS file? I have seen them, but only in files which had mixed line endings, which should of course never be used. Vim does indeed notice it's a 'dos' file, but it's merely detecting that the file has \r\n line endings and that it should add those too. I don't consider that bad. Even better, go Unicode. Unicode specifies that there are 8 ways to make a new line, and they should all be accepted. However, the pretty uncommon NEL, LS and PS are not supported in many applications. (though CR, LF and CRLF are). Nothing you've suggested is necessarily bad, but more to the point, it doesn't come close to invalidating the benefit of PHP_EOL. I'm not saying using PHP_EOL is bad, but I disagree with using it always as a habit. If line endings matter, then you need to make decisions based on that, and don't depend on it being automatically OK if PHP_EOL is used. - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Post to different domain
On Tue, Feb 14, 2012 at 13:14, Rick Dwyer rpdw...@earthlink.net wrote: Hello all. If I have a form on domain A that uses POST to submit data and I want to submit the form to domain B on an entirely different server, how do I pull the form values (... echo $_POST[myval] returns nothing) from the form at domain B? First (basic, obvious) question: do you have full access to both domains, or is Domain B a third-party site? -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Post to different domain
On Feb 14, 2012, at 1:16 PM, Daniel Brown wrote: On Tue, Feb 14, 2012 at 13:14, Rick Dwyer rpdw...@earthlink.net wrote: Hello all. If I have a form on domain A that uses POST to submit data and I want to submit the form to domain B on an entirely different server, how do I pull the form values (... echo $_POST[myval] returns nothing) from the form at domain B? First (basic, obvious) question: do you have full access to both domains, or is Domain B a third-party site? I only have access to domain B... the one receiving the Form POST. --Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Post to different domain
On Tue, Feb 14, 2012 at 13:36, Rick Dwyer rpdw...@earthlink.net wrote: I only have access to domain B... the one receiving the Form POST. Then all you should need to do is: a.) Verify that Domain A is indeed pointing to Domain B, to the script you expect, as a POST request. b.) In the POST-receiving script on Domain B, try this simple snippet: ?php echo 'pre'.PHP_EOL; var_dump($_POST); die('/pre'); ? That should give you all data from the post request. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Post to different domain
Thanks Dan. As it turned out the reason for not showing the passed values is that I didn't have www in the destination address and the values must have been getting lost when Apache redirected requests without www to the fully formed URL. --Rick On Feb 14, 2012, at 1:39 PM, Daniel Brown wrote: On Tue, Feb 14, 2012 at 13:36, Rick Dwyer rpdw...@earthlink.net wrote: I only have access to domain B... the one receiving the Form POST. Then all you should need to do is: a.) Verify that Domain A is indeed pointing to Domain B, to the script you expect, as a POST request. b.) In the POST-receiving script on Domain B, try this simple snippet: ?php echo 'pre'.PHP_EOL; var_dump($_POST); die('/pre'); ? That should give you all data from the post request. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php