דילוג לתוכן
  • דף הבית
  • קטגוריות
  • פוסטים אחרונים
  • משתמשים
  • חיפוש
  • חוקי הפורום
כיווץ
תחומים

תחומים - פורום חרדי מקצועי

💡 רוצה לזכור קריאת שמע בזמן? לחץ כאן!
  1. דף הבית
  2. תכנות
  3. מה עלי לעשות כדי לפתור את השגיאה הזו בהתקנת מיילגן?

מה עלי לעשות כדי לפתור את השגיאה הזו בהתקנת מיילגן?

מתוזמן נעוץ נעול הועבר תכנות
18 פוסטים 4 כותבים 683 צפיות
  • מהישן לחדש
  • מהחדש לישן
  • הכי הרבה הצבעות
התחברו כדי לפרסם תגובה
נושא זה נמחק. רק משתמשים עם הרשאות מתאימות יוכלו לצפות בו.
  • chagoldC מנותק
    chagoldC מנותק
    chagold
    כתב ב נערך לאחרונה על ידי
    #6

    @שואף אמר במה עלי לעשות כדי לפתור את השגיאה הזו בהתקנת מיילגן?:

    php-http/guzzle6-adapter

    השגיאה כאן

    php-http/guzzle6-adapter

    תגובה 1 תגובה אחרונה
    0
    • dovidD מנותק
      dovidD מנותק
      dovid ניהול
      כתב ב נערך לאחרונה על ידי
      #7

      https://github.com/mailgun/mailgun-php/issues/154
      תבדוק אם משהו שם עוזר לך.

      שים לב שאתה לא חייב בכלל את הספריה של mailgun אתה יכול לעבוד "לבד" מול mailgun או עם smtp או עם בקשות REST.
      תוכל להסתכל בדוגמאות הcurl שבאתר mailgun, למשל פה:
      https://documentation.mailgun.com/en/latest/quickstart-sending.html#send-via-api

      ולכתוב קוד PHP דומה. תוכל להיעזר בממירים אוטומטיים ברשת כמו זה
      https://incarnate.github.io/curl-to-php/

      בהצלחה.

      מנטור אישי למתכנתים (ולא רק) – להתקדם לשלב הבא!

      בכל נושא אפשר ליצור קשר dovid@tchumim.com

      chagoldC תגובה 1 תגובה אחרונה
      1
      • chagoldC מנותק
        chagoldC מנותק
        chagold
        השיב לdovid ב נערך לאחרונה על ידי
        #8

        @dovid אמר במה עלי לעשות כדי לפתור את השגיאה הזו בהתקנת מיילגן?:

        תוכל להסתכל בדוגמאות הcurl שבאתר mailgun, למשל פה:
        https://documentation.mailgun.com/en/latest/quickstart-sending.html#send-via-api

        את זה רציתי לעשות (וזה php), אבל אני מקבל שגיאה בשורה של use Mailgun\Mailgun;
        הבנתי שזה בגלל שאני צריך להתקין את מיילגן. ולכן שאלתי.

        מה לא הבנתי נכון?

        dovidD תגובה 1 תגובה אחרונה
        0
        • dovidD מנותק
          dovidD מנותק
          dovid ניהול
          השיב לchagold ב נערך לאחרונה על ידי
          #9

          @chagold אכן לא הבנת אותי.
          תעיף כל זכר לmailgun בקוד שלך.
          צור פונקציית PHP חדשה משלך, תקרא לה SendMail ותבצע בה את הcurl כפי הדוגמא שמופיעה שם תחת המקטע Send via API.
          ככה זה נראה:

          curl -s --user 'api:YOUR_API_KEY' \
              https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages \
              -F from='Excited User <mailgun@YOUR_DOMAIN_NAME>' \
              -F to=YOU@YOUR_DOMAIN_NAME \
              -F to=bar@example.com \
              -F subject='Hello' \
              -F text='Testing some Mailgun awesomeness!'
          

          ואיך עושים את זה בPHP? לכן אני נעזר באתר הזה https://incarnate.github.io/curl-to-php/
          שמביא לי את התוצאה הזו:

          // Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
          $ch = curl_init();
          
          curl_setopt($ch, CURLOPT_URL, 'https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages');
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
          curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
          
          curl_setopt($ch, CURLOPT_USERPWD, 'api' . ':' . 'YOUR_API_KEY');
          
          $result = curl_exec($ch);
          if (curl_errno($ch)) {
              echo 'Error:' . curl_error($ch);
          }
          curl_close ($ch);
          

          כמובן שהספריה זה טוב יותר כי זה נותן שגיאות נכונות ואפשרויות וכו', אבל אם לא עובד לא עובד - ודאי שזה לא צריך לעכב אותך.

          מנטור אישי למתכנתים (ולא רק) – להתקדם לשלב הבא!

          בכל נושא אפשר ליצור קשר dovid@tchumim.com

          תגובה 1 תגובה אחרונה
          1
          • dovidD מנותק
            dovidD מנותק
            dovid ניהול
            כתב ב נערך לאחרונה על ידי dovid
            #10

            כעת אני וראה שהקוד שנוצר בכלל לא טוב.
            אני מחפש גנרייטור אחר... 🙂

            מנטור אישי למתכנתים (ולא רק) – להתקדם לשלב הבא!

            בכל נושא אפשר ליצור קשר dovid@tchumim.com

            תגובה 1 תגובה אחרונה
            0
            • dovidD מנותק
              dovidD מנותק
              dovid ניהול
              כתב ב נערך לאחרונה על ידי
              #11

              מצאתי, PostMan.
              עשיתי File > Import... שם בחרתי בRaw Text והדבקתי את הcurl.
              לאחר האישור לוחצים על הלחצן קוד בצד שמאל, ובוחרים מהרשימה PHP, יש שם שלושה אפשרויות curl של php, או httpRequest ועוד משהו לא זוכר. הנה הקוד ע"י ספריית httpRequest

              <?php
              
              $request = new HttpRequest();
              $request->setUrl('https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages');
              $request->setMethod(HTTP_METH_POST);
              
              $request->setHeaders(array(
                'Postman-Token' => 'ae379c5e-c99c-4d04-be83-f76ed00f725c',
                'cache-control' => 'no-cache',
                'content-type' => 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW'
              ));
              
              $request->setBody('------WebKitFormBoundary7MA4YWxkTrZu0gW
              Content-Disposition: form-data; name="from"
              
              Excited User <mailgun@YOUR_DOMAIN_NAME>
              ------WebKitFormBoundary7MA4YWxkTrZu0gW
              Content-Disposition: form-data; name="to"
              
              YOU@YOUR_DOMAIN_NAME
              ------WebKitFormBoundary7MA4YWxkTrZu0gW
              Content-Disposition: form-data; name="to"
              
              bar@example.com
              ------WebKitFormBoundary7MA4YWxkTrZu0gW
              Content-Disposition: form-data; name="subject"
              
              Hello
              ------WebKitFormBoundary7MA4YWxkTrZu0gW
              Content-Disposition: form-data; name="text"
              
              Testing some Mailgun awesomeness!
              ------WebKitFormBoundary7MA4YWxkTrZu0gW--');
              
              try {
                $response = $request->send();
              
                echo $response->getBody();
              } catch (HttpException $ex) {
                echo $ex;
              }
              

              תכניס את זה לפונקציה מסודרת ותשתיל את הפרמטרים לשלוח והמקבל וכו'.

              מנטור אישי למתכנתים (ולא רק) – להתקדם לשלב הבא!

              בכל נושא אפשר ליצור קשר dovid@tchumim.com

              תגובה 1 תגובה אחרונה
              2
              • chagoldC מנותק
                chagoldC מנותק
                chagold
                כתב ב נערך לאחרונה על ידי
                #12

                א. תודה.
                ב. יש שגיאה

                An exception occurred: [Error] Class 'shareinmambers\HttpRequest' not found
                

                ניסיתי להתקין

                 pecl install -f pecl_http-1.7.6
                

                ויש שגיאה. אני מצרף את הלוג

                 root@forum:~# pecl install -f pecl_http-1.7.6
                 
                 WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
                 
                 downloading pecl_http-1.7.6.tgz ...
                 
                 Starting to download pecl_http-1.7.6.tgz (174,722 bytes)
                 
                 .....done: 174,722 bytes
                 
                 71 source files, building
                 
                 running: phpize
                 
                 Configuring for:
                 
                 PHP Api Version:         20170718
                 
                 Zend Module Api No:      20170718
                 
                 Zend Extension Api No:   320170718
                 
                 whether to enable cURL HTTP requests; specify libcurl directory [yes] :
                 
                 whether to enable support for gzencoded/deflated message bodies; specify zlib directory [yes] :
                 
                 whether to enable response content type guessing; specify libmagic directory [no] :
                 
                 whether to depend on extensions which have been built shared [yes] :
                 
                 building in /tmp/pear/temp/pear-build-rootz6Lgwx/pecl_http-1.7.6
                 
                 running: /tmp/pear/temp/pecl_http/configure --with-php-config=/usr/bin/php-config --with-http-curl-requests --with-http-zlib-compression --with-http-magic-mime=no --with-http-shared-deps
                 
                 checking for grep that handles long lines and -e... /bin/grep
                 
                 checking for egrep... /bin/grep -E
                 
                 checking for a sed that does not truncate output... /bin/sed
                 
                 checking for cc... cc
                 
                 checking whether the C compiler works... yes
                 
                 checking for C compiler default output file name... a.out
                 
                 checking for suffix of executables...
                 
                 checking whether we are cross compiling... no
                 
                 checking for suffix of object files... o
                 
                 checking whether we are using the GNU C compiler... yes
                 
                 checking whether cc accepts -g... yes
                 
                 checking for cc option to accept ISO C89... none needed
                 
                 checking how to run the C preprocessor... cc -E
                 
                 checking for icc... no
                 
                 checking for suncc... no
                 
                 checking whether cc understands -c and -o together... yes
                 
                 checking for system library directory... lib
                 
                 checking if compiler supports -R... no
                 
                 checking if compiler supports -Wl,-rpath,... yes
                 
                 checking build system type... x86_64-pc-linux-gnu
                 
                 checking host system type... x86_64-pc-linux-gnu
                 
                 checking target system type... x86_64-pc-linux-gnu
                 
                 checking for PHP prefix... /usr
                 
                 checking for PHP includes... -I/usr/include/php/20170718 -I/usr/include/php/20170718/main -I/usr/include/php/20170718/TSRM -I/usr/include/php/20170718/Zend -I/usr/include/php/20170718/ext -I/usr/include/php/20170718/ext/date/lib
                 
                 checking for PHP extension directory... /usr/lib/php/20170718
                 
                 checking for PHP installed headers prefix... /usr/include/php/20170718
                 
                 checking if debug is enabled... no
                 
                 checking if zts is enabled... no
                 
                 checking for re2c... no
                 
                 configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
                 
                 checking for gawk... gawk
                 
                 checking whether to enable extended HTTP support... yes, shared
                 
                 checking whether to depend on extensions which have been built shared... yes
                 
                 checking whether to enable cURL HTTP request support... yes
                 
                 checking whether to enable libevent support fur cURL... yes
                 
                 checking whether to enable zlib encodings support... yes
                 
                 checking whether to enable response content type guessing... no
                 
                 checking for egrep... (cached) /bin/grep -E
                 
                 checking for a sed that does not truncate output... (cached) /bin/sed
                 
                 checking how to run the C preprocessor... cc -E
                 
                 checking for ANSI C header files... yes
                 
                 checking for sys/types.h... yes
                 
                 checking for sys/stat.h... yes
                 
                 checking for stdlib.h... yes
                 
                 checking for string.h... yes
                 
                 checking for memory.h... yes
                 
                 checking for strings.h... yes
                 
                 checking for inttypes.h... yes
                 
                 checking for stdint.h... yes
                 
                 checking for unistd.h... yes
                 
                 checking netdb.h usability... yes
                 
                 checking netdb.h presence... yes
                 
                 checking for netdb.h... yes
                 
                 checking for unistd.h... (cached) yes
                 
                 checking for gethostname... yes
                 
                 checking for getdomainname... yes
                 
                 checking for getservbyport... yes
                 
                 checking for getservbyname... yes
                 
                 checking for zlib.h... found in /usr
                 
                 checking for zlib version >= 1.2.0.4... 1.2.11
                 
                 checking for curl/curl.h... not found
                 
                 configure: error: could not find curl/curl.h
                 
                 ERROR: `/tmp/pear/temp/pecl_http/configure --with-php-config=/usr/bin/php-config --with-http-curl-requests --with-http-zlib-compression --with-http-magic-mime=no --with-http-shared-deps' failed
                
                תגובה 1 תגובה אחרונה
                0
                • dovidD מנותק
                  dovidD מנותק
                  dovid ניהול
                  כתב ב נערך לאחרונה על ידי
                  #13

                  נסה את אשר הובא בstack

                  sudo apt-get install libcurl3-dev
                  

                  אח"כ תנסה להתקין שוב את הpecl_http

                  מנטור אישי למתכנתים (ולא רק) – להתקדם לשלב הבא!

                  בכל נושא אפשר ליצור קשר dovid@tchumim.com

                  תגובה 1 תגובה אחרונה
                  0
                  • chagoldC מנותק
                    chagoldC מנותק
                    chagold
                    כתב ב נערך לאחרונה על ידי
                    #14

                    אין שינוי

                    dovidD תגובה 1 תגובה אחרונה
                    0
                    • dovidD מנותק
                      dovidD מנותק
                      dovid ניהול
                      השיב לchagold ב נערך לאחרונה על ידי
                      #15

                      @chagold תנסה להתקין את זה
                      libcurl4-gnutls-dev

                      מנטור אישי למתכנתים (ולא רק) – להתקדם לשלב הבא!

                      בכל נושא אפשר ליצור קשר dovid@tchumim.com

                      תגובה 1 תגובה אחרונה
                      0
                      • chagoldC מנותק
                        chagoldC מנותק
                        chagold
                        כתב ב נערך לאחרונה על ידי
                        #16

                        לא משתנה.

                        תגובה 1 תגובה אחרונה
                        0
                        • chagoldC מנותק
                          chagoldC מנותק
                          chagold
                          כתב ב נערך לאחרונה על ידי
                          #17

                          אבל נראה לי שעם Curl זה עובד אז נחכה עם זה כרגע.
                          תודה רבה.

                          תגובה 1 תגובה אחרונה
                          0
                          • chagoldC מנותק
                            chagoldC מנותק
                            chagold
                            כתב ב נערך לאחרונה על ידי
                            #18

                            קיבלתי עם זה תשובה Forbidden

                            אז בסוף העתקתי את הקוד מכאן וזה עובד טוב.
                            תודה.

                            תגובה 1 תגובה אחרונה
                            0

                            בא תתחבר לדף היומי!
                            • התחברות

                            • אין לך חשבון עדיין? הרשמה

                            • התחברו או הירשמו כדי לחפש.
                            • פוסט ראשון
                              פוסט אחרון
                            0
                            • דף הבית
                            • קטגוריות
                            • פוסטים אחרונים
                            • משתמשים
                            • חיפוש
                            • חוקי הפורום