PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
JellyFish
DevNet Resident
Posts: 1361 Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA
Post
by JellyFish » Fri Aug 24, 2007 12:40 pm
Code: Select all
<?php
function HttpRequest($address, $data)
{
$url = parse_url($address);
while (list($key, $value) = each($data))
{
$dataToPost .= "$key=$value&";
}
$dataToPost = rtrim($dataToPost, "&");
$request = "POST ".$url['path']." HTTP/1.0\r\n"
. "Host: ".$url['host']."\r\n"
. "Content-Type: application/x-www-form-urlencoded;\r\n"
. "Content-Length: ".strlen($dataToPost)."\r\n"
. "\r\n"
. $dataToPost;
$socket = @fsockopen($url['host'], 80, $errno, $errstr) or die("Error: unable to open a socket connection with ".$url['host']."\n $errno: $errstr");
fwrite($socket, $request);
// Response
$response = '';
while (!feof($socket)) {
$response .= fpassthru($socket);
}
fclose($socket);
return $response;
}
?>
Code: Select all
HttpRequest("https://www.linkpointcentral.com/lpc/servlet/lppay", $anArray);
My question is: Would the above call to the function HttpRequest post $anArray to "
https://www.linkpointcentral.com/lpc/servlet/lppay "?
VladSun
DevNet Master
Posts: 4313 Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria
Post
by VladSun » Fri Aug 24, 2007 12:50 pm
I don't see any problems - have you tried it?
There are 10 types of people in this world, those who understand binary and those who don't
JellyFish
DevNet Resident
Posts: 1361 Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA
Post
by JellyFish » Fri Aug 24, 2007 1:00 pm
VladSun wrote: I don't see any problems - have you tried it?
Yeah, this is the response I get:
Are you familiar with link point?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Aug 24, 2007 4:12 pm
HTTPS (SSL) does not communicate on port 80 by default. It uses 443, if memory serves.
JellyFish
DevNet Resident
Posts: 1361 Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA
Post
by JellyFish » Fri Aug 24, 2007 4:44 pm
feyd wrote: HTTPS (SSL) does not communicate on port 80 by default. It uses 443, if memory serves.
When I changed the port number:
Code: Select all
$socket = @fsockopen($url['host'], 443, $errno, $errstr) or die("Error: unable to open a socket connection with ".$url['host']."\n $errno: $errstr");
I get:
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Aug 24, 2007 4:47 pm
Did you read the documentation for the function a little more on SSL?
JellyFish
DevNet Resident
Posts: 1361 Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA
Post
by JellyFish » Fri Aug 24, 2007 4:59 pm
feyd wrote: Did you read the documentation for the function a little more on SSL?
Which function, which documentation. I don't know of any SSL documentation, I guess now would be a good time to ask for some good resources.
But other then the port number does everything else look alright like it would send the data in the right format and get the full response?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Aug 24, 2007 9:47 pm
....
fsockopen() 's documentation states a few things about SSL pretty quick..