Code : Simple Store for AmaZon AFF.

เริ่มโดย EThaiZone, 30 มกราคม 2007, 09:57:19

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

amaudy

เฮ้อ! ผมน่าจะเจอก่อนหน้านี้ซักสามเดือน
จะได้ไม่ต้องซื้อหนังสือ
ตั้ง 984 บาท สั่งตรงจาก Amazon.com

ก๊อบโค้ดไว้ก่อน จะหาเวลาลองเล่นครับ
ขอบคุณมากครับ

EThaiZone

น่าจะเอามาถามในบอร์ดดูครับ

คราวหลังลองถามก่อนดูก็ได้ อิๆ

kingmaster

กำ Fatal error: Call to undefined function: simplexml_load_string() in C:\AppServ\www\acne\SimpleStore.php on line 79

อีกละ...

:x  :x  :x

EThaiZone

หนูลืมบอกปายยย

สำหรับ php5 นะจ๊ะ อิๆ

www.php.net/simplexml_load_string

kingmaster

อ้างถึงจาก: EThaiZoneหนูลืมบอกปายยย

สำหรับ php5 นะจ๊ะ อิๆ

www.php.net/simplexml_load_string

เหอะ ๆ แล้วก็ไม่บอกแต่แรก ให้เรางมโข่งอยู่ตั้งนาน...

:lol:  :lol:  :lol:

sealinda

:shock:  :shock:  ไม่เข้าใจเรยยยยอ่า  :oops:  :oops:  :oops:

จ้างทำเลยได้มั้ยคะเนี่ย  :oops:  :oops:  :oops:  :oops:  :oops:  :oops:
[direct=http://www.thaiseoboard.com/index.php/topic,95911.msg1197898.html#msg1197898]รับบริจาคของขวัญ สำหรับงานวันเด็ก (ส.ที่ 9 ม.ค. 53 ที่บ้านราชวิถี)[/direct] |[direct=http://www.sealinda.com/]ขายส่งเีครื่องสำอางแบรนด์เนม[/direct] | [direct=http://www.girliza.com/]เทคนิคการแต่งหน้า&บำรุงผิว[/direct]|[direct=http://bookmark.girliza.com]บุ๊คมาร์คแซ่บๆ[/direct]

kingmaster

5555+++

เป็นกรรมของผมจริง ๆ อุตส่าห์ตั้งหน้าตั้งตานั่งโมดิไฟด์ตั้งนาน พอเสร็จแล้วอัพโหลดขึ้นโฮส  กำ.....  ใช้ไม่ได้(สงสัยไม่ใช่ php 5 )

ตกม้าตาย อิอิ

ใครใช้กับ hostmonster ได้บอกด้วยนะครับ...

:lol:  :lol:  :lol:

EThaiZone

จะจ้างใครทำ ผมขอแนะนำคุณเต้ tee++;

ผมได้คุยกับเขาทางเอ็มไม่นานมานี้

เขาเป็นphp5 ด้วย ก็ลองเอาไว้เป็นหนึ่งตัวเลือกละกัน ^^

อีกอย่างที่แนะนำคุณเต้เพราะ
เขาสามารถทำมันให้เป็น php4 แน่นอน  :lol:
ผมก็แค่เชื่ออะน่ะ แต่คิดว่าทำได้แน่ๆ

แต่เป็นผมๆ ขอแนะนำให้ใช้ php5 ดีกว่า

ขนาด simplexml ที่มีมาใหม่ ผมว่ามันเขียนได้ง่ายกว่าเดิมมากมายนัก  :lol:

jatuphum

php5 ก็ดีครับแต่ก็ต้องยอมรับความจริงที่ว่าในตอนนี้จะมีhost สักกี่ที่ที่เค้ารองรับ php5 แต่ว่าถ้า version php4 เสร็จแล้วจะมีแจกเปล่าครับ  :D

EThaiZone

เพิ่งถามมาสดๆ จาก hostmonster รัน php5 ได้ครับ เขาบอกไว้อะน่ะ

ส่วนการแปลงเป็น php4 ไม่ใช่เรื่องง่าย ดังนั้นอย่าถามกะผม  :lol:
แค่หามาแจกได้ผมก็ถือว่าโชคดีมากแล้ว เพราะหาเองมาหลายวันเหมือนกัน

กะคุณ tee++; ก็อีกเรื่อง คุณอาจต้องจ้างเขา เพราะเขาไม่ได้ทำ adsense

Tee++;

อ้างถึงจาก: EThaiZoneจะจ้างใครทำ ผมขอแนะนำคุณเต้ tee++;

ผมได้คุยกับเขาทางเอ็มไม่นานมานี้

เขาเป็นphp5 ด้วย ก็ลองเอาไว้เป็นหนึ่งตัวเลือกละกัน ^^

อีกอย่างที่แนะนำคุณเต้เพราะ
เขาสามารถทำมันให้เป็น php4 แน่นอน  :lol:
ผมก็แค่เชื่ออะน่ะ แต่คิดว่าทำได้แน่ๆ

แต่เป็นผมๆ ขอแนะนำให้ใช้ php5 ดีกว่า

ขนาด simplexml ที่มีมาใหม่ ผมว่ามันเขียนได้ง่ายกว่าเดิมมากมายนัก  :lol:

Tee++; อ่านว่าตี๋ อ่ะ เศร้านะ  :cry: ล้อเล่นๆ อิอิ ขอบคุณครับที่แนะนำผม WoW

สำหรับใครที่จะทำเองแนะนำได้ครับ
//$response = file_get_contents($request);
  $parsed_xml = simplexml_load_string($response);
  printSearchResults($parsed_xml, $SearchIndex);


ให้แก้เป็น

$response = file_get_contents($request);
   printSearchResults4php4($response, $SearchIndex);


แล้วเอา พวก library ที่ใช้อ่าน xml มาใช้ก็ได้ อ่านออกมาแล้วไป แก้ที่ ฟังก์ชั่นแต่ละจุด ผมแนะนำ

http://keithdevens.com/software/phpxml

ถ้าใช้ตัวที่ผมบอก ตัวอย่างใน Function printSearchResults ที่เราจะแก้เป็น printSearchResults4php4

จะมีหน้าตาออกมาแบบนี้

function printSearchResults4php4($response, $SearchIndex) {
   $data = XML_unserialize($response);
   $parsed_xml = $data[ItemSearchResponse];
   $numOfItems = $parsed_xml[Items][TotalResults];
   $totalPages = $parsed_xml[Items][TotalPages];
   $CartId = $_GET['CartId'];
   $HMAC = $_GET['HMAC'];
   print ("<table>");
   if ($numOfItems > 0) {
       foreach ($parsed_xml[Items][Item] as $current) {
           print ("<tr><td><img src='".$current[MediumImage][URL]."'></td>");
           print ("<td><font size='-1'><b>".$current[ItemAttributes][Title]."</b>");
           if (isset($current[ItemAttributes][Director])){
               print ("<br>Director: ".$current[ItemAttributes][Director]);
           } elseif(isset($current[ItemAttributes][Author])) {
               print ("<br>Author: ".$current[ItemAttributes][Author]);
           } elseif(isset($current[ItemAttributes][Artist])) {
               print ("<br>Artist: ".$current[ItemAttributes][Artist]);
           }
           print ("<br>Price: ".$current[Offers][Offer][OfferListing][Price][FormattedPrice]);
           $asin = $current[ASIN];
           $details = "SimpleStore.php?Action=SeeDetails&ASIN=$asin&SearchIndex=$SearchIndex&CartId=$CartId&HMAC=$HMAC";
           print ("<br><a href=$details>See Details</a>");
           $CartAdd = "SimpleStore.php?Action=CartAdd&ASIN=$asin&CartId=$CartId&HMAC=$HMAC";
           print ("&nbsp;&nbsp;&nbsp; <a href=$CartAdd>Add to Cart</a>");
           print ("<tr><td colspan=2>&nbsp;</td> </tr> ");
       }
   } else {
       print ("<center>No matches found.</center>");
   }
   print ("<tr><td align='left'>");
   if ($_GET['ItemPage'] > 1 && $totalPages > 1){
       $Keywords = urlencode($_GET['Keywords']);
       $ItemPage = $_GET['ItemPage']-1;
       $prevPage = "SimpleStore.php?Action=Search&SearchIndex=$SearchIndex&Keywords=$Keywords&ItemPage=$ItemPage&CartId=$CartId&HMAC=$HMAC";
       print ("<a href=$prevPage>Previous Page</a></td><td align='right'>");
   }
   if($_GET['ItemPage'] < $totalPages){
       $Keywords = urlencode($_GET['Keywords']);
       $ItemPage = $_GET['ItemPage']+1;
       $nextPage = "SimpleStore.php?Action=Search&SearchIndex=$SearchIndex&Keywords=$Keywords&ItemPage=$ItemPage&CartId=$CartId&HMAC=$HMAC";
       print ("<a href=$nextPage>Next Page</a></td></tr>");
   }
   print ("</table>");
}


ที่เหลือก็คือเราต้องนั่งไล่แก้ไปทีละจุด ซึ่งมันเยอะ และตาลาย  :lol:

ตัวอย่างที่แก้ไปแล้ว (บางส่วน)
http://one2shop.org/samples/amazon/amazonAPI4.php

ถ้าใครจะเอาไปทำต่อ โหลดไปแก้ได้เลยครับที่
http://one2shop.org/samples/amazon.rar

ส่วนผมขอตัวก่อนครับ งานมันมาทับแล้ว เลยไม่ว่างแก้ต่อ แต่ว่าหลักมันทำเหมือนเดิม คือ เอา Function ที่ Error ออกแล้วแก้ไปเรื่อยๆ ตามตัวอย่าง

**ส่วนที่ยังแก้ไม่เสร็จ ก็แค่ Show cart และก็ add Remove ลองเอาไปทำกันเองดูนะ  :lol:
[direct=http://laravel.in.th]Laravel in Thai[/direct]
[direct=http://jquerytips.com]jQueryTips by Tee++;[/direct]
[direct=https://www.facebook.com/jQueryTips]jQueryTips Page[/direct]
[direct=https://www.facebook.com/Laravel.in.th]Laravel in Thai Page[/direct]
[direct=https://twitter.com/Teepluss]Teepluss's Twitter[/direct]


EThaiZone

โทษทีครับ ความจำผมมันสั้น

วันนี้ก็มีคนโทรมาหาผม เดาว่าจากเสียวบอร์ดหรือคนอื่นในเน็ต

แต่ผมก็จำไม่ได้ว่าใคร ถามชื่อได้พัก ตอนนี้ลืมแล้ว ไม่กล้าโทรกลับด้วย (อายอะ)

kingmaster

โอ้ว... งง มาก ๆ key ที่ใช้มันคนละตัวกับ Associates ID นิครับ แล้วมันจะได้ตังยังไงอ่ะ รู้สึกว่าจะแค่ดึงข้อมูลมาอ่ะนะ ใช่ป่ะครับ เราไม่ได้ตังค์นิครับ ถ้ามีคนซื้ออ่ะ

ถ้าเป็นอย่างนี้ก็คงไม่ต่างกับ ebay rss อ่ะครับ....

Tee++;

อ้างถึงจาก: kingmasterโอ้ว... งง มาก ๆ key ที่ใช้มันคนละตัวกับ Associates ID นิครับ แล้วมันจะได้ตังยังไงอ่ะ รู้สึกว่าจะแค่ดึงข้อมูลมาอ่ะนะ ใช่ป่ะครับ เราไม่ได้ตังค์นิครับ ถ้ามีคนซื้ออ่ะ

ถ้าเป็นอย่างนี้ก็คงไม่ต่างกับ ebay rss อ่ะครับ....

อันนี้ผมก็สงสัยอ่ะ ได้ตังค์ ยังไง แต่รู้สึกว่ามันน่าจะได้นะ เพราะมันอยู่ใน หมวด make money นิ
[direct=http://laravel.in.th]Laravel in Thai[/direct]
[direct=http://jquerytips.com]jQueryTips by Tee++;[/direct]
[direct=https://www.facebook.com/jQueryTips]jQueryTips Page[/direct]
[direct=https://www.facebook.com/Laravel.in.th]Laravel in Thai Page[/direct]
[direct=https://twitter.com/Teepluss]Teepluss's Twitter[/direct]