PHP question (newbie)

Discussion in 'PHP' started by btfans, Nov 24, 2005.

  1. #1
    PHP question (newbie)

    As my Company block this ball result page, I (newbie) write this little php code try
    to get the text(not graph) of the page and display using my server:

    http://mylink.com/ballr1.php (code as bottom)

    The problem is it show very good the first page but not the history data link
    that can be enquired inside, because the url became
    http://mylink.com/srchRes.asp?srchDate=1&fromD=24&fromM=11&fromY=2005&toD=25&toM=11&toY=2005&teamName=

    which must be 404 url not found!

    My question:
    Any advise how the below code can be change such that I can actually get

    http://bet.hkjc.com/football/en/results/srchRes.asp?srchDate=1&fromD=24&fromM=11&fromY=2005&toD=25&toM=11&toY=2005&teamName=

    and the display on my server again ?? Many Thanks.

    ballr1.php

    
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Result</title>
    </head>
    <body>
    Result
    <hr><br>
    
    <?
    	$file = "http://bet.hkjc.com/football/en/results/results.aspx";
    	$contents = file($file);
    	$size = sizeof($contents);
    	for($i = 0; $i < $size; $i++) {
    	
    	$alldata = $contents[$i];
    	echo $alldata; }
    
    ?>
    </body>
    </html>
    
    Code (markup):
     
    btfans, Nov 24, 2005 IP
  2. draculus

    draculus Peon

    Messages:
    63
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can use the base tag to acheive this. Add

    
    <base href="http://bet.hkjc.com/football/en/results/">
    
    Code (markup):
    between the head tags of your output page.

    The base tag tells the browser to use the path specified when resolving relative paths in the page rather than the path of the page itself.
     
    draculus, Nov 24, 2005 IP
  3. btfans

    btfans Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank draculus


    Understand that:
    1) after balr1.php display the site html first time, the history data can be enquired by pressing the 'Search' button inside
    but ballr1.php need intercept this button to form a link fist like:
    http://mylink.com/ballr1.php?srchRes.asp?srchDate=1&fromD=24&fromM=11&fromY=2005&toD=25&toM=11&toY=2005&teamName=
    but not just
    http://mylink.com/srchRes.asp?srchDate=1&fromD=24&fromM=11&fromY=2005&toD=25&toM=11&toY=2005&teamName=
    2) when the ballr1.php is invoked again with the variable parameters (from/to dates etc.), it need to do something
    to change the base url to:
    http://bet.hkjc.com/football/en/results/srchRes.asp?srchDate=1&fromD=24&fromM=11&fromY=2005&toD=25&toM=11&toY=2005&teamName=

    I am really newbie to php, so appreciated anyone point me the solution code.
     
    btfans, Nov 24, 2005 IP
  4. btfans

    btfans Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4

    It's because the result link is correct, but will be blocked again !

    http://bet.hkjc.com/football/en/results/srchRes.asp?srchDate=1&fromD=24&fromM=11&fromY=2005&toD=25&toM=11&toY=2005&teamName=
     
    btfans, Nov 25, 2005 IP
  5. btfans

    btfans Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    So any one can help on 'any code' I can used to view
    the blocked ball pages with those from/to data enquiry
    thru the 'Search' button ?

    Many Thanks,
     
    btfans, Nov 28, 2005 IP
  6. btfans

    btfans Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Pls close it's resolved.
     
    btfans, Dec 5, 2005 IP