abhishekphp6 Posted March 14, 2010 Share Posted March 14, 2010 Hello, I have written the following PHP code <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://ice.auspost.com.au/display.asp?ShowFirstScreenOnly=FALSE&ShowFirstRecOnly=TRUE'); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,"txtItemNumber=EQ001125608AU"); $data = curl_exec ($ch); curl_close($ch); echo ' length of data: ' . strlen($data) . '<br/>'; ?> What I want is that the page should display the length of the output page which the script has created. Instead what is happening is that the contents are being displayed on my page and the length of the output string is 1. What I want is that the content of the resultant page is populated in my $data variable. And I don't want to display the resultant page (result of posting to the asp page) to be displayed directly on my PHP page. Can you please help! Link to comment https://forums.phpfreaks.com/topic/195173-post-data-to-a-form-using-curl/ Share on other sites More sharing options...
slurpee Posted March 14, 2010 Share Posted March 14, 2010 You're going to want to set the "CURLOPT_RETURNTRANSFER" option to 1: curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); Link to comment https://forums.phpfreaks.com/topic/195173-post-data-to-a-form-using-curl/#findComment-1025842 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.