PHP - Collecting Data From Websites?
is it possible to collect data from another website and insert it into my db?, lets say for example: http://www.imdb.com/title/tt0285331/episodes#season-1
could i somehow get the Episode name eg: Quote Episode 1: 12:00 a.m.-1:00 a.m. and the description Quote Jack Bauer is called to his office because there's a threat on the life of a US Senator who's running for President; Jack also discovers that his daughter has skipped out her bedroom window. and place that into a table in my db? any help would be great. Similar TutorialsHey Everyone hope all well. I am in need of your php experience. I will try to explain the best as i can : I have an html form and inside of that form i have a "select a state" option: Code: [Select] <select name="State"> <option value="0" selected="selected">Select a State</option> <option value="AL">Alabama</option> <option value="AK">Alaska</option> <option value="AZ">Arizona</option> <option value="AR">Arkansas</option> etc..... </select> When the customer selects a state and then clicks the forms submit button, i want them to get taken to a csv file. Inside of the csv file i have this Code: [Select] state, ip AL,67.100.244.74 AK,68.20.131.135 AK,64.134.225.33 etc....... My goal is to collect the state they choose in the html file and bring it to this csv file. Once it comes to the csv file it chooses an ip address according to the state they choose, then that ip address is sent to me in an email with the rest of the form information. So an example would be: customer fills out the html form and selects Alabama as a state. they then submit the form and the form comes to the csv file where it sees the state Alabama (AL). it then collects the ip and submits that to my email address along with the rest of the html form information (name,email,etc...). It also needs to randomly choose an ip from Alabama because in the csv file i have Alabama (AL) multiple times, so i just chooses anyone of the Alabama ip's I hope i am making sense Thanks for all your help Ali Hello guys, I have intermediate level PHP and I am currently working on a website. I need to write a function that will get me some specific information from a website. I need this function to go write the users name on the search bar over the http://competitive.eune.leagueoflegends.com/ladders/eune/current/rankedsolo5x5 after it founds which page the user is on I want the information of that user registered on my database. But I am not sure where to start.. An example would be like http://competitive.eune.leagueoflegends.com/ladders/eune/current/rankedsolo5x5?summoner_name=&page=4 page 5: rank 121 Sokoren 42 22 1877 I already know the name, I just need the other numerical information and get them into my database. I only want this function to work when a certain nick name is entered. Any help would be appreciated. At the moment I collect data from an .XML file and it gets inserted into a database and it works great however the way in which the .xml files work has changed and I need to update my script to accommodate,
before everything was processed by 1x .xml file and i collected data, now its done via 2x .xml files.
So here is my current script;
<?php // INCLUDE DB CONNECTION FILE include("includes/connect.php"); // CHANGE THE VALUES HERE include("includes/config.php"); // URL FOR XML DATA $url = "https://api.eveonline.com/corp/StarbaseList.xml.aspx?keyID=".$keyID."&vCode=".$vCode.""; // RUN XML DATA READY FOR INSERT $xml = simplexml_load_file($url); // Loop Through Names $insertValues = array(); $modifiedTS = date('Y-m-d h:i:s'); foreach ($xml->result->rowset[0] as $value) { //Prepare the values $itemID = $value['itemID']; $typeID = mysql_real_escape_string($value['typeID']); $locationID = $value['locationID']; $moonID = $value['moonID']; $state = mysql_real_escape_string($value['state']); $stateTimestamp = mysql_real_escape_string($value['stateTimestamp']); $onlineTimestamp = $value['onlineTimestamp']; $standingOwnerID = $value['standingOwnerID']; //Create and run ONE INSERT statement (with UPDATE clause) $insert = "INSERT INTO `ecmt_poslist` (itemID,typeID,locationID,moonID,state,stateTimestamp,onlineTimestamp,standingOwnerID,last_modified) VALUES('$itemID','$typeID','$locationID','$moonID','$state','$stateTimestamp','$onlineTimestamp','$standingOwnerID','$modifiedTS') ON DUPLICATE KEY UPDATE state='$state', stateTimestamp='$stateTimestamp', onlineTimestamp='$onlineTimestamp', last_modified = '$modifiedTS'"; mysql_query($insert) or die(mysql_error()); //ERROR CHECKING OPTION ONLY! //echo $insert; //echo "<br><br>"; }; //UPDATE last time this script ran and insert timestamp into Database $timeNow = date('Y-m-d H:i:s', strtotime('-1 hour')); $insertTime = "UPDATE `ecmt_API` SET time=1, time='$timeNow'"; mysql_query($insertTime) or die(mysql_error()); //Run query to delete records that were not just inserted/updated $delete = "DELETE FROM `ecmt_poslist` WHERE last_modified < '$modifiedTS'"; mysql_query($delete) or die(mysql_error()); ?>and here is the wiki page about the .xml file and its data; http://wiki.eve-id.n...tarbaseList_XML i now need it to collect more data from a 2nd .xml file but the url will include the $itemID of the items pulled by the above script; http://wiki.eve-id.n...rbaseDetail_XML now i guess i need to put the code in the above foreach loop so I can say for each $itemID gather data from the second .xml file and input into a seperate table in my database named: `ecmt_poslistdetails` but i have no idea where to start as the rowset and layout of the 2nd .xml file is different, can anyone help me.. i'm not even sure if I wrote out this post to make sense from someone looking in from outside or not. its hard to explain. but hopefully the links provided will help. Ultimately I hope to have 2 tables in my database ecmt_poslist and ecmt_poslistdetails both containing the data from the above 2x .xml files. I have 2 websites currentweb.com copyweb.com (say) Using php can I update 2 databases and upload files in both these 2 websites ( for both these web sites I have user id and password exmaple I am uploading a file (Image), in currentweb.com can I upload it to copyweb.com at the same ( I have database and ftp password for this ) If Yes Please help with code I have created 5 websites under 5 different domains. Contents of this websites' are similar and using a same template for each one. Now I need to create an admin panel to control these websites. PHP and MySql I will use for this backend.
My problem is how can I manage these five website with one backend? Reason is I will use different domain for my backend. My all 5 client will use this same backend system to manage their own website.
So can I know from the professionals here, is it possible to display mysql data on these 5 website. If it is possible then how?
Any links to article or tutorials would be welcome and appreciated.
NOTE: I checked
mysql federated storage enginebut no idea? Is it the way where do I need to go? Thank you. Hello!
I have five websites on a single server, and each website uses the same geographic data, for instance US zip codes and city/state latitudes and longitudes. Each website uses it's own copy of these "large" tables.
I would like to avoid having to maintain the same data in 5 databases, but I am more concerned with database performance, e.g., the speed at which the data is retrieved for each website.
Question: Should I set up a new separate database that contains the shared tables for all websites and allow each website to connect to this new database for shared data? Or is it better for each website have it's own copy of the duplicate tables?
Thanks for any info!
Cheers
Hey, Im busy making a social network style wall feed for my site where people make a status and people can comment. Now when some one comments the users active in the comment wall + original status maker gets notified but now the issue is theres so many while loops going on im thinking there must be a better way? My current method is as follows: 1) Get the userid of the person who made the status 2) Collect all unique userid's of all the people who made a comment 3) Create the array of userids 4) Loop the array and insert row after row of each userid to notify them a comment was made on a feed they are active on. Thing is - im thinking when i scale it up with alot of users this looping is going to increase the load alot so is there really any more efficient method i can use ? My website needs to collect credit card information WITHOUT 3rd party!
I asked godaddy what i is i need for that and they told me if i get a merchandising account with my bank and call them to tell them what i want to do they will send me a script and i use that script on my site.
Does anyone have experience with this?
my server is PCI compliant
Hi there, hope one of you can help me with a problem im just having. Ok, lets start with the explanation what i want to to: I'd like to collect headlines from a html site, and get the test results in an array, so that the array structure represents the dom-levels of the site. Small Example: <h1>test1.1<h1/> <h2>test2.1</h2> <h2>test2.2</h2> <h3>test3</h3> <h1>test1.2<h1/> Shoul end in a array structure like: Code: [Select] array('level 1' => array ( 'sibble1' => array ( 'headline' => 'test1.1', 'level2' => array( 'sibble1' => array ( 'headline' => 'test2.1', 'level3' => array(), // empty data, needs to be processed anyway to find gaps, to maybe a h4 headline would be existing ), 'sibble2' => array ( 'headline' => 'test2.2', 'level3' => array ( 'sibble1' => array ( 'headline' => 'test3.1', 'level4' => array(), // empty data, needs to be processed anyway to find gaps, to maybe a h4 headline would be existing ), ), ), ), ), 'sibble2' => array ( 'headline' => 'test1.1', 'level2' => array(), ), ), ); So i hope out of this example you can see what i want to do. level represents the healdine level 1-9, sibblin is as name for the childs on the headline level. Ok, so to extract the herefore needed data out of the html, i build a class with a recursive function, that filters the html by a regex from one headline to the next, first iteratin all childs, if there are no more childs i go tho ne nextsibbling element. as an running example code look he Code: [Select] <?php class Application_Model_DomParser { const PREG_MATCH_ONE_ELEMENT_TO_MUCH_LENGTH = 4; private $slicedFields = array(); public function __construct() { } public function sliceFirstSectionToDataFields($level = 1, $haystack) { preg_match_all("#(.*?)<h$level>(.*?)</h$level>(.*?)(<h$level>|$)#s", $haystack, $data); // prepare the chunkData $pageText = ''; if (isset($data[1][0])) { $pageText = $data[1][0]; } $headline = ''; if (isset($data[2][0])) { $headline = $data[2][0]; } $dataToProcessNextLevel =''; if (isset($data[3][0])) { $dataToProcessNextLevel = $data[3][0]; } // @todo dirty warnings compression, search why warning occures @$posOfNextChild = strlen($data[0][0]) - self::PREG_MATCH_ONE_ELEMENT_TO_MUCH_LENGTH; // from here goes the debug... echo $headline ."::" .strlen($dataToProcessNextLevel). "<br>"; if (strlen($dataToProcessNextLevel) <= self::PREG_MATCH_ONE_ELEMENT_TO_MUCH_LENGTH) { if ($level < 9) { $dataToProcessNextLevel = $haystack; } else { return; } } //recursive check for next level in $dataToProcessNextLevel $nextLevel = $level + 1; $this->sliceFirstSectionToDataFields($nextLevel, $dataToProcessNextLevel); $haystack = substr($haystack, $posOfNextChild); // slized To The End if (self::PREG_MATCH_ONE_ELEMENT_TO_MUCH_LENGTH == strlen($haystack)) { // die("slized To The End"); return; } // recursive check for other childs in actuall level... $this->sliceFirstSectionToDataFields($level, $haystack); } } $htmlString = 'test<h1>headkline1.1</h1> <p>test test</p> <h2>headline 2.1</h2>test test <h2>headline 2.2</h2> <p>tes test test</p> <h3>headline 3.1</h3>test <h3>headline 3.2</h3>test <h2>headline 2.3</h2> <p> </p> <p>test</p> <h1>headline 1.2</h1> <h2>headline 2.4</h2> <p>11111111111112222222222222222222222</p> <p> ewfwrefg upowmdg w3q09umq09wrt n3q089ty 3q0898943ty -98 41</p> <h3>headline 3.3</h3> <p>test</p> <p>test</p> <p>test</p> <h1>1.3 testtest</h1> <p>test</p> <h3>head 3.4</h3> <p>sadfsadfsadf asdfsda f sdaas saf saddas</p> <h3>head 3.4</h3> <h3>test 1.3</h3> <p>test;</p> '; $model = new Application_Model_DomParser(); $result = $model->sliceFirstSectionToDataFields(1, $this->htmlString); So letting this piece of code run, you can se via the debug echo, every headline is found, even in the right order of its occurence. My problem now is dont get it how to return the extracted values, and collect them to get a result as my above shown structure shows. So i spent ours to solve this problem but didnt come to a result. I know its a hard problem, and to help me takes time, cause its a complex situation. Allthough i hope someone knows a anser. I need this problem solved, to get my mind rested! Thanks, and greetings Selma Here's a random example: macbundlebox.com/the-spring-bundle/ (I purposely excluded the http://www. so people won't think this is spam) Notice how there are 11 apps listed? So suppose someone buys the package, I'm assuming they get emailed a unique license/activation code to activate that particular software? Or they get a link to download the software? Or they email each customer a unique username/password to download that software. I am not a PHP guru but I am almost certain that this is done in php and works in one of 3 ways: - Either the app developers give a giant list of licenses that are assigned by the webmaster per purchase - A URL is pinged after each purchase which sends a license back and is directly emailed to the customer - A URL is pinged and the app developers send the license to the customer So my question is...seeing as how most of you are very knowledgeable in PHP, is there any client management/billing software that you know of that could accomplish the above, and be easily managed by a non-PHP guru (perhaps even be integrated into a CMS like Wordpress?)? If not, how much would it cost (give or take) to have it built? does anyone have an example of new code that is used this day in age for combining js and PHP to produce dynamic content on a webpage? I have looked at this from w3schools: https://www.w3schools.com/php/php_ajax_database.asp but I believe that XMLHttpRequest is really old. If I rememeber my reading right, it was replaced by fetch() a long time ago. I think i understand everything that is on that tutorial page, but I would love to see a video tutorial on this subject. can anyone here point me to such a resource? Edited December 11, 2019 by ajetrumpetIs there a way I can scan one of my websites for directories and files if it is not on the same server? I can scan just fine on the same server but not if it is on another server/website. since it is not the same server I tried to give the full path: http://www.site.com but it would not work. can this even be done? Hi everybody
I am one stressed person right now.
I had been away for a while only to return recently and find out that none of my websites (with Hostpapa) had been working.
I sent the technical support team an email and they told me that my websites were not PHP 5.4 compatible.
They also said:
"As register_globals is deprecated in PHP 5.4 and because of this you are receiving errors on your website. You will have to update your website code and remove register global references. If this can not be done then in that case the last option would be to upgrade to VPS hosting."
Why have things just suddenly changed?
How can I fix this problem?
It's affected many of the sites on my host - and in some cases - the submission forms are not working in connection with my Aweber account.
Please help as this has shocked me quite badly - and needs resolving asap.
Thank you in advance
Okay so I am scraping websites for their descriptions keywords and titles. I noticed that a lot of websites use the same keywords and descriptions on every page.. so my idea is to scrape the index and find all the links in there and scrape them all then after they been scraped check all of the descriptions and if the descriptions match then pull some text unique to each page and use that. I can't seem to wrap my head around it.. how would I accomplish this? I scrape with curl then find keywords description and title then find all links on the site and scrape those. soo I was thinking making an array of the descriptions and then checking and inserting to the db but doesn't seem like it would work. Any ideas? Oh also.. how would I grab just text from each page that is different from every other page? lol very confusing HI guys Im developing Health site using PHP and mysql. I want to create graphs from using data in the database on weekly basis. so please tell me what is the best method of creating graphs and charts in php thank in advance Code: [Select] if($login_count == 1) { while ($row = mysql_fetch_array($login_sql, MYSQL_ASSOC)) { $_SESSION['MembersID'] = $row['members_id']; session_register('MembersID'); }} this works fine and logs me in on my website with the script and displays the correct id with: Code: [Select] if(isset($_SESSION['MembersID'])){ $session_id = $_SESSION['MembersID']; echo'<li><a href="https://members.selmgec.co.uk/">Welcome, '.$session_id.'</a></li>'; } but how can i pass it onto another website i own, using the same database connection. I'm new in php and I don't have knowledge of php.
I just want to know, whenever we download file from server to Desktop through FTP, there are whitespaces occuring in files.
Like html websites, we always remove whitespaces whenever we upload the file to server after editing it. Is this step necessary for php websites also? If necessary then how to do it?
I got a good one for you guys, I run 20 or so websites on my server all that have very similar coding structures. On all sites, I have a php script for a mysql table that logs visitors and I filter out bots(google, yahoo, etc, as many as I know of), but since many new ones are discovered weekly/monthly, I hate manually going through all sites and adding the new bot to the array of existing bots for detection. I know there are a few ways to do this, but I'd like to know the most efficient way of basically doing one function/task/opertation and it automatically updating all website's to know the new bots without manually modifying all 20 php files every time. The sites are all on the same server, but at different domains. a few ideas, which are prob not the best 1) have a universal text file that I could update that would be located in some file on one of my sites that just has a list of all bots and then each site would read from that text file to know what bots to filter. 2) have a huge php file to execute that has all connection info/passwords for every site and runs a php script to update the corresponding website's mysql table that would hold each bot as a row in the table. the script would just add a new row with the new bot info. so then ultimately when logging visitors, it would have to read the database each time 3) try to "include" a universal .php file that's located on one of my sites that has the array of all bots. But I've tried to include a file from another domain and I know that's a security error and won't include the file as a .php, but rather the file after it's been processed. There's gotta be a better solution. any ideas? I have developed a form for my website that directs the user to a different site and per-populates the form on the other site with information I want. I would like to take it one step further and make the below script fill out the form on the other site and then submit the form. Currently it just fills out the form on the other site but does not submit it. Is there any way to do this? Code: [Select] <form action="http://www.privatedutyhomecare.org/sections/consumers/locator.php" method="POST"> <input name="state" size="25" type="hidden" value="MI" /> <input name="company" size="25" type="hidden" value="Affordable HomeCare" /> <button type="submit" class="imgpx"> <img src="assets/images/logos/npda.png" alt="submit" width="51" class="nothing" height="40" /> </button> </form> How is it possible for a website to know my physical location? Some websites I've seen will have ads such as; meet singles in "HOMETOWNGOESHERE" I'm guessing this kind of info is found from my Ip address? Has anyone ever done anything like this in php, I'm interested to know how this works. |