Google Answers Logo
View Question
 
Q: Php coding question ( Answered 5 out of 5 stars,   1 Comment )
Question  
Subject: Php coding question
Category: Computers > Programming
Asked by: thisquestion-ga
List Price: $35.00
Posted: 02 Jun 2006 07:40 PDT
Expires: 02 Jul 2006 07:40 PDT
Question ID: 734727
I need a piece of php code that will solve the following task. Please
test the php code to make sure it works.

Task:
Please look at this URL
http://www.prosper.com/public/lend/listing.aspx?listingID=16145

The following php code successfully writes the source code of this
page into the variable $htmldata:
$listing = 16145;
$srcurl = 'http://www.prosper.com/public/lend/listing.aspx?listingID=' . $listing;
$htmldata = file_get_contents ("$srcurl");

But now look at the link at the bottom right of the page saying "Next"
which allows to open the next page with follwoing bids (51-100).

I need php code that will get me these subsequent listing bids pages
into the string $htmldata.

Naturally it should work for any listing number. $listing=16145; is only an example.
Answer  
Subject: Re: Php coding question
Answered By: tox-ga on 04 Jun 2006 04:18 PDT
Rated:5 out of 5 stars
 
thisquestion-ga,

I have placed the requested function in the file:

www.maxlin.ca/get_pages.zip

To use, simply extract the get_pages.php to the directory you want to
use it and add:

<? include ("get_pages.php"); ?>

to the top of your php file.

An example usage of the function would be (ensure the CURL modules in
PHP are enabled):

echo get_pages("http://www.prosper.com/public/lend/listing.aspx?listingID=","16327");

As a side note, you probably want to increase the time-out of the PHP
script since this site is rather slow. To do this, use:

set_time_limit("300");

or some other suitable parameter (300 is in seconds).


Cheers,

tox-ga
thisquestion-ga rated this answer:5 out of 5 stars
thx - works as desired

Comments  
Subject: Re: Php coding question
From: seventoes-ga on 03 Jun 2006 22:50 PDT
 
if i understand correctly...

in php:

<?php
$listing = $_GET['listing'];
$nextListing = $listing+1;
$srcurl = 'http://www.prosper.com/public/lend/listing.aspx?listingID='
. $nextListing;
$htmldata = file_get_contents($srcurl);

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy