This is a discussion on PHP Nightmare.....Integration into ebaY listings within the PHP Language forums, part of the PHP Programming Forums category; Hi guys, I've been searching all day for a method on how to integrate the listings off ebaY onto ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi guys,
I've been searching all day for a method on how to integrate the listings off ebaY onto my website, but I have had no joy whatsoever. I want to be able to open a listing based on the the item number, which I can do simply by using, $ITEMNUMER = ("blah"); http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=$ITEMNUMER but, I cannot use include(); to achieve what I want to do, because a) it is having trouble including external webpages b) the ebaY listing is generated upon arrival, so theres no way it could interperate it. I've been trying all kinds of fopen(); techniques, but nothing seems to be able to open the page, because (I assume) it doesn't exist till an actual browser visits it, and it calls it values from the ebaY database. So, I tied using the ebaY API, but I'll need to pay a hellish amount to use it, so it seems out the question. What I really want to do is have a script check a listing for some text. But, as I cannot get PHP to open the file, I'm stuck ! If anyone knows a way how I can strip some information out of an external web page using PHP - it would be gladly appriciated. |
|
|||
|
lessani@gmail.com (ben lessani) wrote in
news:536703d4.0502131045.6f206d80@posting.google.c om: > Hi guys, > > I've been searching all day for a method on how to integrate the > listings off ebaY onto my website, but I have had no joy whatsoever. > > I want to be able to open a listing based on the the item number, > which I can do simply by using, > > $ITEMNUMER = ("blah"); > http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=$ITEMNUMER > > [...] > > What I really want to do is have a script check a listing for some > text. But, as I cannot get PHP to open the file, I'm stuck ! <?php $data = file_get_contents("http://cgi.ebay.co.uk/ws/eBayISAPI.dll? ViewItem&item=4356967161"); if(preg_match("/potty/i", $data, $match)){ echo "This eBay listing says '$match[0]'"; } ?> (Don't ask me, I searched eBay for "PHP" and that came up...) hth -- Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fung.arg'); --------------------------|--------------------------------- <http://www.phplabs.com/> | PHP scripts, webmaster resources |
|
|||
|
I tried that, and got...
Fatal error: Call to undefined function: file_get_contents() in e:\phpdev\www\ebaytraders.com\test.php on line 12 Any more help ? Thanks anyway, BTW Senator Jay Billington Bulworth wrote: > lessani@gmail.com (ben lessani) wrote in > news:536703d4.0502131045.6f206d80@posting.google.c om: > > > Hi guys, > > > > I've been searching all day for a method on how to integrate the > > listings off ebaY onto my website, but I have had no joy whatsoever. > > > > I want to be able to open a listing based on the the item number, > > which I can do simply by using, > > > > $ITEMNUMER = ("blah"); > > http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=$ITEMNUMER > > > > [...] > > > > What I really want to do is have a script check a listing for some > > text. But, as I cannot get PHP to open the file, I'm stuck ! > > <?php > > $data = file_get_contents("http://cgi.ebay.co.uk/ws/eBayISAPI.dll? > ViewItem&item=4356967161"); > > if(preg_match("/potty/i", $data, $match)){ > echo "This eBay listing says '$match[0]'"; > } > > ?> > > (Don't ask me, I searched eBay for "PHP" and that came up...) > > hth > > > -- > > Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fung.arg'); > --------------------------|--------------------------------- > <http://www.phplabs.com/> | PHP scripts, webmaster resources |
|
|||
|
lessani@gmail.com wrote in news:1108321417.931184.43170
@c13g2000cwb.googlegroups.com: > I tried that, and got... > > Fatal error: Call to undefined function: file_get_contents() in > e:\phpdev\www\ebaytraders.com\test.php on line 12 > > Any more help ? Which version of PHP are you using? If it's <4.3, this should work instead: <?php $data = join('', file("http://cgi.ebay.co.uk/ws/eBayISAPI.dll? ViewItem&item=4356967161")); if(preg_match("/potty/i", $data, $match)){ echo "This eBay listing contains '$match[0]'"; } ?> hth -- Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fung.arg'); --------------------------|--------------------------------- <http://www.phplabs.com/> | PHP scripts, webmaster resources |
|
|||
|
I now have the following errors. I did a quick check, and I am running
PHP version...4.2.3 Warning: file(" http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=4356967161") - Invalid argument in e:\phpdev\www\ebaytraders.com\test.php on line 14 Warning: Bad arguments to join() in e:\phpdev\www\ebaytraders.com\test.php on line 14 |
|
|||
|
lessani@gmail.com wrote in news:1108322269.247069.179110
@z14g2000cwz.googlegroups.com: > I now have the following errors. I did a quick check, and I am running > PHP version...4.2.3 > > Warning: file(" > http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=4356967161") - > Invalid argument in e:\phpdev\www\ebaytraders.com\test.php on line 14 > > Warning: Bad arguments to join() in > e:\phpdev\www\ebaytraders.com\test.php on line 14 OK, it looks like you may not have the URL fopen() wrappers enabled. Check your php.ini file for this setting: allow_url_fopen = 1 Make sure it's set to 1. If it already is, I'm not sure what to suggest; I'm not very familiar with PHP running under Windows. hth -- Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fung.arg'); --------------------------|--------------------------------- <http://www.phplabs.com/> | PHP scripts, webmaster resources |
|
|||
|
Okay, I've been running all my scripts on my local machine using phpDev
- which is probably what is causing me all these errors. I just created a file with the following code onto an online webserver of mine, and it worked straight away. <?php // Get a file into an array. In this example we'll go through HTTP to get // the HTML source of a URL. $lines = file('http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=4356967161/'); // Loop through our array, show HTML source as HTML source; and line numbers too. foreach ($lines as $line_num => $line) { echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n"; } // Another example, let's get a web page into a string. See also file_get_contents(). $html = implode('', file('http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=4356967161/')); ?> Looks like I've set up PHP poorly on my machine, or the Proxy I'm forced to use is blocking the pages. Thanks very much for your help ! Ben |
|
|||
|
"ben" <lessani@gmail.com> wrote in news:1108323818.774983.143370
@z14g2000cwz.googlegroups.com: > It is turned on, but I suspect my proxy is causing it problems. I'll > try and stick to using my webhosting for this project. Probably is something local, then - I just saw your other post re: everything is working fine on your remote server. > I don't suppose you know of any webhosts that supply free MySQL and PHP > ? I'm not aware of any free hosts that support PHP/MySQL, but it's been awhile since I looked into free hosts. I can suggest bluevirtual.com if you're in the market for paid virtual hosting. No affiliation, just a satisfied customer who followed the founders from their old employer, where I'd been hosted since '98. hth -- Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fung.arg'); --------------------------|--------------------------------- <http://www.phplabs.com/> | PHP scripts, webmaster resources -- Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fung.arg'); --------------------------|--------------------------------- <http://www.phplabs.com/> | PHP scripts, webmaster resources |
|
|||
|
For a free host, you can always host yourself.
"Senator Jay Billington Bulworth" <f@fung.arg> wrote in message news:Xns95FC8F8DF805ECANDLETRUCK@65.24.7.50... > "ben" <lessani@gmail.com> wrote in news:1108323818.774983.143370 > @z14g2000cwz.googlegroups.com: > >> It is turned on, but I suspect my proxy is causing it problems. I'll >> try and stick to using my webhosting for this project. > > Probably is something local, then - I just saw your other post re: > everything is working fine on your remote server. > >> I don't suppose you know of any webhosts that supply free MySQL and PHP >> ? > > I'm not aware of any free hosts that support PHP/MySQL, but it's been > awhile since I looked into free hosts. I can suggest bluevirtual.com if > you're in the market for paid virtual hosting. No affiliation, just a > satisfied customer who followed the founders from their old employer, > where I'd been hosted since '98. > > hth > > -- > > Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fung.arg'); > --------------------------|--------------------------------- > <http://www.phplabs.com/> | PHP scripts, webmaster resources > > > -- > > Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fung.arg'); > --------------------------|--------------------------------- > <http://www.phplabs.com/> | PHP scripts, webmaster resources |