הרשם שאלות ותשובות רשימת חברים לוח שנה חיפוש הודעות מהיום סמן פורומים כנקראו

   
|!|

השב
 
כלים לאשכול תצורת הצגה
ישן 28-10-08, 17:36   # 1
vadimg88
חבר מתקדם
 
מיני פרופיל
תאריך הצטרפות: Feb 2008
גיל: 37
הודעות: 710

vadimg88 לא מחובר  

נסה את זה , זה עובד לי מצויין:

קוד:
<?php


$host = 'domain.com'; // gateway host
$path = '/file.php'; // gateway uri
$autotaxusername = "***";
$autotaxpass = "*****";

$fh = fsockopen("$host", 80, $errno, $error, 15);
if ($fh)
{
	$params = "phone=".$phone."&message=".urlencode($message);
	$headers = array
	(	"Host: $host",
	"Connection: close",
	"Cookie: username=".$autotaxusername."; password=".$autotaxpass,
	"Content-Length: ".strlen($params),
	"Content-Type: application/x-www-form-urlencoded"
	);
	fwrite($fh, "POST $path HTTP/1.1\r\n".implode("\r\n", $headers)."\r\n\r\n");
	fwrite($fh, $params);
	$data = '';
	/*(for ($i=0; !feof($fh) && $i<20; $i++)
	{
	$data .= fgets($fp, 1024);
	}*/
	$data .= fread($fh, 5000);
	fclose($fh);

}

?>
  Reply With Quote
ישן 28-10-08, 19:18   # 2
Jerba
חבר בקהילה
 
מיני פרופיל
תאריך הצטרפות: Jun 2007
הודעות: 300

Jerba לא מחובר  

אם יש לך נסיון בסוקטים בשפות אחרות אז הנה קוד שבטוח תבין , מאוד דומה לסוקטים אמיתיים חח

PHP קוד:
<?php
//error_reporting(E_ALL);

echo "<h2>TCP/IP Connection</h2>\n";

/* Get the port for the WWW service. */
$service_port 100;

/* Get the IP address for the target host. */
$address '192.168.2.1';



/* Create a TCP/IP socket. */
$socket socket_create(AF_INETSOCK_STREAMSOL_TCP);
if (
$socket === false) {
    echo 
"socket_create() failed: reason: " socket_strerror(socket_last_error()) . "\n";
} else {
    echo 
"OK.\n";
}

echo 
"Attempting to connect to '$address' on port '$service_port'...";
$result socket_connect($socket$address$service_port);
if (
$result === false) {
    echo 
"socket_connect() failed.\nReason: ($result) " socket_strerror(socket_last_error($socket)) . "\n";
} else {
    echo 
"OK.\n";
}

$in 'GET / \r\n\r\n';
$out '';

echo 
"Sending HTTP HEAD request...";
socket_write($socket$instrlen($in));
echo 
"OK.\n";

echo 
"Reading response:\n\n";
while (
$out socket_read($socket1024)) 
{
    echo 
$out;
}

echo 
"Closing socket...";
socket_close($socket);
echo 
"OK.\n\n";
?>
  Reply With Quote
השב

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 

כלים לאשכול
תצורת הצגה

חוקי פירסום
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 02:13.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ