This is the header that my PHP script sends via fsockopen
POST /xyz/add.aspx HTTP/1.0
User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0
But it returns:
Bad Header (Invalid Header Name)
I have to do it without cURL
Please tell me what is wrong ?
You have white space between Content-Type and Content-Length which should not be there.
Hi thanks for your reply.
I just removed the blank line, but the result stays the same.
Please help ! so much views and no one replied apart from just 1 ?
You are using = instead of : in several of your headers which isn't allowed (based on what I see at fsocketopen)
Thanks YES, I already fixed that and also added POSTDATA: etc. That thing worked now.
But, now, the new issue is : I get this message:
<b>Warning</b>: fgets(): SSL: The operation completed successfully.
Please Help !
Post your code, as I can't tell you what that means without seeing it.
Here is the code:
$headers = "POST /abc/add.aspx HTTP/1.1\\r\
$headers .= "Host: mysite.com\\r\
$headers .= "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0\\r\
$headers .= "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\\r\
$headers .= "Accept-Language: en-US,en;q=0.5\\r\
$headers .= "Accept-Encoding: gzip, deflate\\r\
$headers .= "Connection: keep-alive\\r\
$headers .= "Referer: https://www.mysite.com/abc/add.aspx\\r\
$headers .= "Cookie: ASP.NET_SessionId=$ASPSESS\\r\
$headers .= "Content-Type: multipart/form-data; boundry=".$d.$boundary."\\r\
$headers .= "Content-Length: $bodyLength\\r\
$headers .= "POSTDATA: $bodyString";
$fp = fsockopen("ssl://www.mysite.com", 443, $errno, $errstr);
$response = '';
$response .= fgets($fp);
What version of PHP are you running this on? A google search I ran seems to indicate this is an issue with lower versions of PHP 4, or any version of PHP that isn't compiled with the openssl option. I'm not 100% certain yet which may be your case, or if there is another reason for this warning to be generated.
I have latest PHP version with OPENSSL installed. If openssl is not installed it shows other error message, not the one i posted.
This topic is now closed. New replies are no longer allowed.