PHP - External Website Data Retrieval (faster)
When I use PHP to gain data from another webpage I usually use
file_get_contents Is there a faster way to retrieve data from webpages faster since it only seems to do around 200 website line retrievals per minute? Is cURL faster? Thank you Similar TutorialsI'm trying to make a League of Legends (a video game) community website, both as a personal project and for practice. Now the game has a lot of champions, each of whom have 5 unique abilities. Now, I thought about manually inputting all the details about each champion into a MySQL database, but that would long and tedious, and I don't really have the time for it now. Also, the game patches very oftern (like, once every 2 weeks) which changes many of the stats, etc. of the champion, and it is not possible for me to keep manually updating these every time there is a patch. Fortunately, there is a League of Legends Wiki which has all the data I need in their specific champion pages, which they keep updated per patch. So I was wondering if there was any way to get the data from the divs in the wiki, and have it display on my site. What I want to do in my website is that whenever someone types a champion's name (in a post or whatever), I want it to display a hover-over dialog with some of the champions details. And a lot of other features such as that. In plain English I need a way to : > Tell PHP to go to the wiki's source code on a specific page > Find a specific div container > Get X data from there > Pass X data into a function to display the hover-over I think this way, I would not have to maintain a database as I can leech off the wiki's data. I have not coded anything like this before, so I would like a few pointers as to how to achieve this. Any help will be appreciated! Hi I am currently making a site where users can upload second hand books for sale, I have everything working as i wish apart from i am having trouble creating a account page where users can review the books they have posted. so far i use the following code to bring view a the data associated with an uploaded book based on its id Code: [Select] public static function getById( $id ) { $conn = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD ); $sql = "SELECT * FROM books WHERE id = :id"; $st = $conn->prepare( $sql ); $st->bindValue( ":id", $id, PDO::PARAM_INT ); $st->execute(); $row = $st->fetch(); $conn = null; if ( $row ) return new Book( $row ); } I think i can use a similar function for my user account however, each book entered by a user has their member id attached to it, which is gained from there id in the members table which in turn is stored in $_SESSION['id']. My question is, is there a way to rework the code above to have something like select * where member_id = $_SESSION['id']. I have tried a few things and get stuck manly due to the fact i dont know what to replace the current :id with. Thanks in advance, i hope i explained it well enough for you lot to understand. Ian Hello, Hello, I am writing a data retrieval script, in order to print data stored in a DB. For some reason the script does not work.. More details below.. Code: [Select] the form that calls the initiator script.. <form method='get' action="init.Get.php"> <div><input type="submit" name="get" value="See Data"></div> </form> Code: [Select] the initiator script <?php include 'dataGet.class.php'; $data= new getData(); $data= getData($name, $email, $text); ?> Code: [Select] my class.. <?php class getData { private $name; private $email; private $text; function __construct(){ $this->host = 'localhost'; $this->uname = 'root'; $this->pword = '1111'; $this->dbname = 'teststorage'; $this->dbtable = 'userData'; } function getData($name, $email, $text){ $this->dbconnect = mysql_connect($this->host, $this->uname, $this->pword); if (!$this->dbconnect) die("Connection Unable " . mysql_error()); mysql_select_db($this->dbname); $sql_query = "SELECT * FROM $this->dbtable "; $result = mysql_query($sql_query); if ($result){ echo $result; } else{ echo "Retrieval Unsuccesful"; } mysql_close($sql_query); } } ?> Can someone please tell me what am I doing wrong? Thank you in advance. Here's the site: http://www.secretauctions.com/thank_atv_cb754.php# (If anyone wants to see how the problem is occurring. The Username and Password shown on the page are functional.) Here's the problem: Whenever anyone tries to click to the second page of results, the Session fails. Here's a short version of the code: Code: [Select] <?php $username = "user493d"; $password = "w7atv"; session_start(); $my_array=array($username, $password); $_SESSION['login']=$my_array; if ($_SESSION['login'][0]=="user493d" && $_SESSION['login'][1]=="w7atv") include("atv_list.php"); else include("sorry1.php"); ?> This works GREAT on the initial log-in. But the moment anyone tries to go to the second page of results, the Error state trips, and they get the "sorry" page. This isn't supposed to happen. This is my first foray into Sessions, so I'm certain there's something I'm not understanding, but shouldn't the above code store the username/password, then use it to verify page reloads? Can anyone tell me why it's allowing the Fail state to trip, when the initial test succeeds? Or am I doing the whole thing wrong? This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=358972.0 Hi, I would like to know how to get The Value Of An Hidden TextBox From an External Website than Mine. I'm Coding an Addons for CCBChurch.com (mychurch.ccbchurch.com/app/trx_submit_bp.php), This is a donation website, They want me to code an addons so people can place it on their website and people can donate. I made it in cURL with POST but they generate a TimeStamp and a TimeStamp encoded, The 2 are on mychurch.ccbchurch.com/app/trx_submit_bp.php on hidden textbox. I would like to get the TS and TSH from the hidden textbox on the website, Is that possible ? I would too like to put it in Variable $ts and $tsh... Thanks ! Hi all, Im just wondering how you go about building a search function to another website, So on my webpage i could have a search that searchs the itunes store or something? Has anybody previous experience with this or can point me in the right direction, I have googled this but all im being shown is an overwhelming amount of results for google instant! thanks in advance I have been trying to figure this out for a friend of mine that wants this done, but I have begun to think that it just isn't possible - for security reasons... I need to run a HTML form on an external website for each url selected - so run through a loop processing the form over and over... Something like: for($i=0;$i<=count($urls);$i++){ // run form on http://website.com using $url[$i] } Can this be done? I am thinking that without recreating the PHP script the site uses in the form, it can't. Part of my page is taken from external webpages by preg_match. Since It is a partial section, it contains incomplete tags such as <div>, <span>, etc. Thus, they mix up with my entire page and my </div>, </span> are used for the incomplete tags in the borrowed section. How I can end such tags? or separate this section from the main codes (I mean having an isolated section)? This is a sample html code i have to work with: Code: [Select] <div class="spaceit_pad"><span class="dark_text">English:</span> Fullmetal Alchemist: Brotherhood</div><div class="spaceit_pad"><span class="dark_text">Synonyms:</span> Hagane no Renkinjutsushi (2009), Fullmetal Alchemist (2009), FMA</div><div class="spaceit_pad"><span class="dark_text">Japanese:</span> 鋼の錬金術師</div> I want to extract Specifically these lines: 1) Code: [Select] Fullmetal Alchemist: Brotherhood2) Code: [Select] Hagane no Renkinjutsushi (2009), Fullmetal Alchemist (2009), FMA3) Code: [Select] 鋼の錬金術師 from that, and all this is loaded from a thrid party website, like wikipedia. please help?
Hi,
URL: http://statistik.innebandy.se/ft.aspx?scr=playercareer&fplid=182506 $data = file_get_contents($url); $dom = new domDocument; @$dom->loadHTML($data); $dom->preserveWhiteSpace = false; $tables = $dom->getElementsByTagName('table'); $rows = $tables->item(2)->getElementsByTagName('tr'); print_r($rows[0]); foreach ($rows as $row) { $cols = $row->getElementsByTagName('td'); }
This i what i want: I'm trying to send some POST data to a page and then get the contents of it. The page is not on my server, so I can't use Sessions or GET. Google hasn't provided me with a definite answer. How would I do this? hello My database is in a same server with seperate domain name , then I want to insert from website1 mysql data on website2 mysql data. can anyone help me? Hello,
I've tried to get a dynamic table from an external page, and searching for entries in it, so i used a dynamic XLS file using php excel reader. I only exported the file, but i couldn't search for data.
Can i get some help please ?
I have been given a task, and I gotta say it is kicking my butt.
Here is what I have to do.
1. Have user fill out and submit a form.
2. Data gets sent to: http://www.ffiec.gov...de/Default.aspx
3. Data is set as values for input fields in the sites form.
4. Form executes.
5. Retrieve result data.
6. Display data back to my site.
I have no idea how to do this.
Usually when I have done something like this I use an API.
Hope my question is clear.
Thanks for the help.
Hi, Is there a way to send extracted information from one (local) MySQL db, via PHP, to an external web form - having that web form submit that info to it's connected MySQL db without human interaction? Basically, I need to automate a process using the $_GET function to that form but not sure if there is a way to accomplish this from just connecting to the web form (itself); bypassing direct MySQL access which is the later option. Any input appreciated - thanks! I need to pass captured data, basically, a list of email addresses that are being read from a CSV file and (1st) saved to an local database, then sent over to an external source via URL string. I have everything working except - script opens the file, read and validates all emails in the specified column, and saves to local db. ISSUE: after validating then INSERTING the data into local mySQL db, I need to then pass each piece of data to an external source via URL string. Example: www.domain.com?email={$new_email} I was initially think to just add the URL in a header function but, I'm not sure if the HEADER() function the right method to pass all of the data - during the loop - via the URL string. For example, if the CSV file contain 500 emails: Q: how can I continue that loop until the last email read, passing each up to the external source via the URL string? I'm not sure if using the HEADER() function at the end of the script - but within the loop - will interate and send each capture email via that URL string. Can anyone advise a possible solution to this? thanks |