View Single Post
ישן 15-04-10, 14:16   # 6
OrPol
א.פורום תוכנה
עסק רשום
 
OrPol's Avatar
 
מיני פרופיל
תאריך הצטרפות: Aug 2006
הודעות: 1,979

OrPol לא מחובר  

בPOST או בGET?
אם מדובר בGET הכל הרבה יותר קל, אתה יכול עם CURL
PHP קוד:
$url_c "http://".$host.":".$port.$path."?".$query// Generates the URL;
            
$curl curl_init($url_c);
            
curl_setopt($curlCURLOPT_HEADERfalse);
            
curl_setopt($curlCURLOPT_VERBOSEfalse);
            
curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
            
$content curl_exec($curl); //Sends the request;
          
echo $content// Echos the respond from application server; 
ואפשר גם עם FSOCKOPEN, אבל לי באופן אישי CURL עבד יותר טוב עם השרתים בארץ
PHP קוד:
$fp fsockopen("$host"$port$errno$errstr30); // Opens a socket to the Application server

if (!$fp) { // Verifies that the socket has been opened and sending the message; 
echo "$errstr ($errno)<br />\n";
} else {
$out "GET $path?$query HTTP/1.1\r\n";
$out .= "Host: $host\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp$out);
while (!
feof($fp)) {
echo 
fgets($fp128); // Echos the respond from application server (you may replace this line with an "Message has been sent" message);
}
fclose($fp);


הקודים הם מתוך קוד לדוגמא שכתבתי לחברה שמספקת WEB SERVICE של SMSים.
אם אתה צריך משהו מעבר, דבר איתי.
  Reply With Quote