Connecting Tech Pros Worldwide Forums | Help | Site Map

PHP Nightmare.....Integration into ebaY listings

ben lessani
Guest
 
Posts: n/a
#1: Jul 17 '05
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.

Senator Jay Billington Bulworth
Guest
 
Posts: n/a
#2: Jul 17 '05

re: PHP Nightmare.....Integration into ebaY listings


lessani@gmail.com (ben lessani) wrote in
news:536703d4.0502131045.6f206d80@posting.google.c om:
[color=blue]
> 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 ![/color]

<?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
Guest
 
Posts: n/a
#3: Jul 17 '05

re: PHP Nightmare.....Integration into ebaY listings


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:[color=blue]
> lessani@gmail.com (ben lessani) wrote in
> news:536703d4.0502131045.6f206d80@posting.google.c om:
>[color=green]
> > 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[/color][/color]
whatsoever.[color=blue][color=green]
> >
> > 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 ![/color]
>
> <?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[/color]

Senator Jay Billington Bulworth
Guest
 
Posts: n/a
#4: Jul 17 '05

re: PHP Nightmare.....Integration into ebaY listings


lessani@gmail.com wrote in news:1108321417.931184.43170
@c13g2000cwb.googlegroups.com:
[color=blue]
> 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 ?[/color]

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
lessani@gmail.com
Guest
 
Posts: n/a
#5: Jul 17 '05

re: PHP Nightmare.....Integration into ebaY listings


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

ben
Guest
 
Posts: n/a
#6: Jul 17 '05

re: PHP Nightmare.....Integration into ebaY listings


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

Senator Jay Billington Bulworth
Guest
 
Posts: n/a
#7: Jul 17 '05

re: PHP Nightmare.....Integration into ebaY listings


lessani@gmail.com wrote in news:1108322269.247069.179110
@z14g2000cwz.googlegroups.com:
[color=blue]
> 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[/color]

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
ben
Guest
 
Posts: n/a
#8: Jul 17 '05

re: PHP Nightmare.....Integration into ebaY listings


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.

I don't suppose you know of any webhosts that supply free MySQL and PHP
?

Ben

Senator Jay Billington Bulworth
Guest
 
Posts: n/a
#9: Jul 17 '05

re: PHP Nightmare.....Integration into ebaY listings


"ben" <lessani@gmail.com> wrote in news:1108323818.774983.143370
@z14g2000cwz.googlegroups.com:
[color=blue]
> 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.[/color]

Probably is something local, then - I just saw your other post re:
everything is working fine on your remote server.
[color=blue]
> I don't suppose you know of any webhosts that supply free MySQL and PHP
> ?[/color]

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
Michael Bradley-Robbins
Guest
 
Posts: n/a
#10: Jul 17 '05

re: PHP Nightmare.....Integration into ebaY listings


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...[color=blue]
> "ben" <lessani@gmail.com> wrote in news:1108323818.774983.143370
> @z14g2000cwz.googlegroups.com:
>[color=green]
>> 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.[/color]
>
> Probably is something local, then - I just saw your other post re:
> everything is working fine on your remote server.
>[color=green]
>> I don't suppose you know of any webhosts that supply free MySQL and PHP
>> ?[/color]
>
> 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[/color]


ben
Guest
 
Posts: n/a
#11: Jul 17 '05

re: PHP Nightmare.....Integration into ebaY listings


I am hosting myself......and thats how I've run into problems :P

ben
Guest
 
Posts: n/a
#12: Jul 17 '05

re: PHP Nightmare.....Integration into ebaY listings


I found a good cheap host in the end.

http://www.geodetech.com/

ben

Closed Thread