Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. You need to construct a proper regular expression for that. You'll need to learn regular expressions.
  2. I'll mark out the steps: 1. Pull the text out of the <script> node with DOMDocument 2. Use a regular expression that will match everything between "bootstrapthisstuff = " and the following line break 3. Decode the JSON 4. Take the value you need out of the resulting object.
  3. If you can show me the page, perhaps I can find a rule that can be used to extract specifically what you're looking for.
  4. I'm making assumptions as to how the HTML is structured, but it should be something like this: foreach($dom->getElementsByTagName('script') as $script) {// First child is a text node with the JSON string in it $JSON = $this1->firstChild->nodeValue; $data = json_decode($JSON, true); echo $data['I_want_this'];} If the $JSON variable does not actually contain an isolated JSON string, then you'll have to use ordinary string manipulation methods to extract it from there. The main idea is that once you've pulled the string out of the document, you don't need to use DOMDocument methods anymore, just treat it like any other string.
  5. You can't use DOMDocument to extract data from JSON. You need to use the json_decode() function for that. First, extract the content from the script element and store it as a string, then pass that string to json_decode to get an object or associative array. After that, you can obtain the value you need from the "I_want_this" property of the object.
  6. The picture location is relative to the location of the file. If the file is in a different folder, you need to change the src attribute of the <img> elements to match the new directory structure. Your page seems to be inside a folder "teoritekst", so you need to move up one directory: <img src="../images/picture.png"
  7. We have a pinned thread at the top of the forum addressing this very issue: http://w3schools.invisionzone.com/index.php?showtopic=44106
  8. If you built a file uploader on your website and the received files are not properly validated before being saved on the server, that's an attack point for a hacker.
  9. The login page is what's being served. If you want something else to be served, you will need to send a POST request with a proper username and password and get a cookie in return. Since curl probably won't save cookies for you, you'll have to manually read the Set-Cookie header and manually send a Cookie header when requesting a new page.
  10. You would need a file upload interface, an organized database and directory structure. If you want the program to automatically generate different quality MP3s I would research into PHP libraries that can encode MP3 files. Research file uploading and databases. There are many tutorials out there including the ones at W3Schools.
  11. Quotation marks are used to delimit strings. If it's not a string then you don't use quotation marks. Numbers are not strings. String is just one type of data, you can read about all the different data types in the PHP tutorial: http://www.w3schools.com/php/php_datatypes.asp
  12. You can make your own stylesheet and include it right after including bootstrap. In that stylesheet you can override any of bootstrap's classes with your own CSS. For example: /* Override bootstraps red button */.btn.btn-danger { color: #C10;}
  13. What is this supposed to do? Room = [129, 135, 133, 130, 128, 231, 235, 233, 230, 228, 232, 226, 331, 337, 333, 335, 330, 328, 332R, 326, 332] Did you read the page about operators?
  14. I don't write code for people (at least not without a salary), I'm here to help people learn. It seems you need to learn the basic syntax of a conditional You need to learn about comparisons, the if() statement and the logical operators: http://www.w3schools.com/js/js_comparisons.asp http://www.w3schools.com/js/js_if_else.asp http://www.w3schools.com/js/js_operators.asp
  15. I actually don't know of a way to do that dynamically. That would require preprocessing the HTML before the browser begins parsing it.
  16. In the DOM inspector, you can change the src attribute of any <script> element on the page. If you want to execute your own Javascript on the page you can write code right into the console.
  17. If you want the value of $_GET['email'] then don't wrap it in quotation marks. $data = array( 'Email' => $_GET['email'], 'EmailType' => 'Html',
  18. You don't seem to have used the variable $times anywhere. Since the weekday name is already the key, you don't need to also have it as a value. It should be more like this: foreach ($content as $day => $times) { echo $day . ' ' . $times['open'] . ' ' . $times['close'] . '<br>';}
  19. I can't know what they're using on the server side, there's nothing sent in the headers or the content that could indicate what language or content management system they're using. Like most sites, they do have Javascript on the page.
  20. The best way to learn to make a game is learning programming in general. C++ and Java are better suited for learning real programming concepts than Javascript is. I would suggest learning about object-oriented programming, data structures in general (arrays, lists, trees, hash tables), searching algorithms and sorting algorithms.
  21. One way to get it would be to look through the <td> elements inside the current <tr> element and if the class attribute is "sort" (using getAttribute()) then get the value of the child node.
  22. If you know where the links are going to be, then you can get the value of the first child, which would be a text node.
  23. You can use AJAX to load stage data from JSON files. An important part of building any software is determining what data structures you need and how you'll use them before beginning to build it.
  24. Game design is a complicated field. I can't teach you that in one post. But you should make your program load the entire game on one page. The reason games aren't spread over multiple pages is that the user can win the game by simply typing a URL into the browser. I see slow loading problems, make sure all the images have finished loading before you start the game. This can be done be putting all the game's images into an array and attaching an onload event to the images.
  25. It's something called collapsing margins. When two elements' margins are adjacent, the larger of the two margins is used while the other is ignored.
×
×
  • Create New...