By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,979 Members | 943 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,979 IT Pros & Developers. It's quick & easy.

PHP Nightmare.....Integration into ebaY listings

P: n/a
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.
Jul 17 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
le*****@gmail.com (ben lessani) wrote in
news:53**************************@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
Jul 17 '05 #2

P: n/a
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:
le*****@gmail.com (ben lessani) wrote in
news:53**************************@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


Jul 17 '05 #3

P: n/a
le*****@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
Jul 17 '05 #4

P: n/a
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

Jul 17 '05 #5

P: n/a
ben
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

Jul 17 '05 #6

P: n/a
le*****@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
Jul 17 '05 #7

P: n/a
ben
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

Jul 17 '05 #8

P: n/a
"ben" <le*****@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
Jul 17 '05 #9

P: n/a
For a free host, you can always host yourself.

"Senator Jay Billington Bulworth" <f@fung.arg> wrote in message
news:Xn*************************@65.24.7.50...
"ben" <le*****@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

Jul 17 '05 #10

P: n/a
ben
I am hosting myself......and thats how I've run into problems :P

Jul 17 '05 #11

P: n/a
ben
I found a good cheap host in the end.

http://www.geodetech.com/

ben

Jul 17 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.