Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 08:09

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



file_get_contents / cURL

Discussion on file_get_contents / cURL within the Web Development forum part of the Coders Den category.

Reply
 
Old   #1

 
elite*gold: 3
The Black Market: 113/0/0
Join Date: Oct 2013
Posts: 5,815
Received Thanks: 1,814
file_get_contents / cURL

Hi,

Ich nutze ein simples Skript, welches Strings von einer anderen Seite aussließt. Dafür nutze ich file_get_contents aber mir wurde gesagt, dass cURL besser und schneller sei. Jedoch blick ich bei cURL nicht ganz durch und wollte daher fragen ob mir jemand das etwas erklären könnte.

Mein Code sieht so aus und den würde ich gerne in cURL umschreiben.
Code:
<?php

$content = file_get_contents('http://www.bns.academy/live-marketplace/?q=Asura+Ember&region=eu');

preg_match('#<span class="gold">(.*)<span>금</span></span>#', $content, $match);
$gold = $match[1];

preg_match('#<span class="silver">(.*) <span>은</span></span>#', $content, $match);
$silver = $match[1];

echo "Preis: $gold G $silver S";

?>
Nevada' is offline  
Old 04/02/2017, 13:35   #2
 
EngelEatos's Avatar
 
elite*gold: 22
Join Date: May 2011
Posts: 516
Received Thanks: 178
PHP Code:
<?php
function cUrlRequest($url){
    
$ch curl_init(); //instantiate an instance of cURL
    
curl_setopt_array($ch, array( //set options
        
CURLOPT_URL => $url//set Url
        
CURLOPT_RETURNTRANSFER => 1)); // Return the response as a string instead of outputting it to the screen
    
if ( isset($_SERVER['HTTP_USER_AGENT']) ) {curl_setopt($chCURLOPT_USERAGENT$_SERVER['HTTP_USER_AGENT']);} //set UserAgent, notnecessary
    
$result curl_exec($ch); //execute cURL request
    
curl_close($ch); //close cURL instance
    
return $result;
}
?>
EngelEatos is offline  
Reply


Similar Threads Similar Threads
Curl mit PHP
05/19/2015 - Web Development - 14 Replies
Hallo wollte um hilfe fragen wollte transaktionen und treasures anzeigen lassen auf der Website und bezahlmethode mit egold einbaurn oder eine art guthaben aufladung. Aber es funktioniert nicht habe es nun von neu vor klappt aber nicht möchte es in wordpress oder anderes Cms nach empfehlung nehmen. Danke. LG
C++ Qt & cURL
05/06/2015 - C/C++ - 1 Replies
Hi, I have actually some trouble making my bot. I do not want to publish my code but i'm searching somebody who can help me because of a little problem who do not want to be resolve :( Can you help me ? Post here or PM me. Thanks a lot !
PHP/Curl Frage
11/15/2014 - Web Development - 0 Replies
Abend, Un-zwar wollte ich einen "TSDNS" Dienst über Cloudflare anbieten mittels SRV Record, ich Scheiter momentan an der Umsetzung die API ist Perfekt Dokumentiert und daher kein Problem Folgendes müsste ausgeführt werden: curl https://www.cloudflare.com/api_json.html \ -d 'a=rec_new' \ -d 'tkn=MEIN_PERMISSION_TOAKEN' \ -d '[email protected]' \ -d 'z=ts3.cx' \
help with curl
05/20/2011 - CO2 Programming - 0 Replies
im trying to log in to a page using curl to modify one of my post like updating that specific post with new information over the time i dont understand very much curl and most of the examples i search are in php and i need it to use with autoit or the cmd directly right now im trying from the start, to get logged in the webpage i have found that i need the names of the inputs user and password and that i need a cookie to receive and to send, but when i check the curl.txt in a browser it...
[PHP] cUrl Login
04/19/2010 - Web Development - 0 Replies
So ich hab ein kleines Problem. Und zwar versuche ich für das Browsergame Space Pioneers einen Bot mit PHP zu schreiben was generell auch kein Problem wäre, allerdings habe ich ein kleines Problem. Und zwar gibt es zwei möglichkeiten sich einzuloggen, das wäre einmal auf Looki und einmal der Notfall Login Login. Nun zu meinem Problem. Das Einloggen im ersten Link klappt soweit ganz gut, ich habe meines errachtens auch alle Inputs mit übergeben, hat mir allerdings keinen Acceskey...



All times are GMT +2. The time now is 08:09.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.