שליחת נתונים ב POST
-
אני מנסה לעלות טקסט מאד ארוך לקובץ ListAllInformation, מדובר על למעלה מאלף שורות, הבעיה שאני מקבל תשובה כזו:
Request-URI Too Long
The requested URL's length exceeds the capacity limit for this server.
@שמואל כתב לי לשלוח את הנתונים בPOST
אשמח לדעת כיצד לעשות זאת חיפשתי הרבה ולא מצאתי הסבר ברור.
אני משתמש ב-2 אפשרויות:
אוfile_get_contentsלמשל :$str = file_get_contents("https://$url/ym/api/UploadTextFile?token=$ApiDID:$password&what=ivr2:EnterID/ListAllInformation.ini&contents=$str"); $str = json_decode($str,true); $str = $str ["responseStatus"]או ב
curlלמשל:$url = "https://$url/ym/api/UploadTextFile?token=$ApiDID:$password&what=ivr2:EnterID/ListAllInformation.ini&contents=$str"; $cURLConnection = curl_init(); curl_setopt($cURLConnection, CURLOPT_URL, $url); curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true); $str = curl_exec($cURLConnection); curl_close($cURLConnection);תודה רבה.
-
@ממפ משהוא בסגנון הזה:
<?php $handle = curl_init(); $YemotUrl = "https://$url/ym/api/UploadTextFile"; $postData = array( 'token' => '.....', 'what' => 'ivr2:EnterID/ListAllInformation.in', 'contents' => '......' ); curl_setopt_array($handle, array( CURLOPT_URL => $YemotUrl, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData, CURLOPT_RETURNTRANSFER => true, ) ); $data = curl_exec($handle); curl_close($handle); echo $data;תחפש מדריכים לcurl. זה אפשרי בcurl.
-
@שמואל תודה רבה!!
עובד מצויין! אין מילים!
שלום! נראה שהשיחה הזו מעניינת אותך, אבל עדיין אין לך חשבון.
נמאס לכם לגלול בין אותם הפוסטים בכל ביקור? כשנרשמים לחשבון, תמיד תחזרו בדיוק למקום שבו הייתם קודם, ותוכלו לבחור לקבל התראות על תגובות חדשות (בין אם במייל, ובין אם בהתראת פוש). תוכלו גם לשמור סימניות ולפרגן ב-upvote לפוסטים כדי להביע הערכה לחברי קהילה אחרים.
בעזרת התרומה שלך, הפוסט הזה יכול להיות אפילו טוב יותר 💗
הרשמה התחברות