need experts help like something else or software-freak

Started on the old forum in March 2012 · view the original in the archive · old links redirect here

31 replies · 1,502 views · started 14 years ago · 1 min read

TL;DR · summary of 31 replies
  • - The fix was to increase the PHP version to support the strstr() function, as it is not supported in versions lower than 5.3.0.
  • - A solution using file_get_contents instead of curl was proposed by just_m3., but Lue_chin preferred to stick with curl for his specific needs.
  • - The issue of handling multiple SMS per page and preventing the script from timing out during execution was addressed, including adding error messages like "ERROR Grabbing content!" or a timeout message.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

7 participants
just_m3. Developer · 199 posts #21

softwarefreak wrote: unfair LOL BTW, setting a timeout while making a grabber is not a gud idea,A blank page is retured w/ a curl error it exceeds the time :S it's better the script reaches max execution time & dies to a fatal error,this is wat I've noticed,may be I'm wrong...🤷

$file = curl_exec($ch);

if(!$file){echo'error grabbing content'; exit;}

anyway ... \

<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />  
<title>Here is my link grabber demo</title>  

<style type="text/css"> 
body{ 
margin: 3px auto;  
font-family : Verdana, arial;  
font-weight : normal;  
font-size : small;  
color : #333333;  
background-color : #ffffff;  
} 

.sms-title { 
    padding-bottom : 2px; 
    padding-top : 2px; 
    background : #FFF; 
    padding-left:4px; 
    border: 1px solid #CCCCCC; 
}  
.sms-body{padding-left:5px;margin-left:5px; 
} 

.sms-body-cont { 
    padding-bottom : 2px; 
    padding-top : 2px; 
    background : #FFF; 
    padding-left:4px; 
    border: 1px solid #CCCCCC; 
}  
</style></head> 

<body>  
<?php  
###############################  
require_once'grab_lib.php';   #  
###############################  

function fetch_sms_content($opp){ 
foreach($opp as $value){ 

$moddmysms = '<!--- From here -->'.$value.'<!-- To here -->'; 

$moddmysms = preg_replace('/<!--- From here --><\!DOCTYPE(.*?)<!-- To here -->/is','',$moddmysms);   

preg_match_all( "#<!--- From here -->(?P<extracted>.+?)<!-- To here -->#sim",$moddmysms, $show ) ; 

$moddmysms = preg_replace('/<\/div><hr>(.*?)<\/html>/is','',$show['extracted'][0]);   

$moddmysms = preg_replace('/<a href="sms:\?body=(.*?)"><font color="brown">Forword Sms<\/font>(.*?)<\/a>/is','<a href="sms:?body=$1">Share by sms</a><br/><a href="http://m.facebook.com/home.php?p=$1">Share on Facebook</a>',$moddmysms);   

$moddmysms=str_replace("Smsming.com",$_SERVER['HTTP_HOST'],$moddmysms); 

preg_match_all( "#<div class=\"sms-body\"><br>(?P<textareacontent>.+?)<a href=\"http:\/\/m#sim",$moddmysms, $my ) ; 

$textarea=str_replace("<br>","\n",$my['textareacontent'][0]); 
$textarea=str_replace("\n\n\n\n","\n",$textarea); 

$retthis="".$moddmysms."<textarea name=\"copy\" cols=\"20\" rows=\"6\">".$textarea."</textarea><br><br>\n\n\n"; 

// doin' this because first result is empty 
$retthis = str_replace('<textarea name="copy" cols="20" rows="6"></textarea><br><br>','',$retthis); 

echo $retthis; }} 

$grab = new grabber();  

$moddmydata = $grab->page('http://smsming.com/cat/April-Fools-Day-Sms.html','fget');  

$moddmydata = preg_replace('/<div class="dark">(.*?)<\/div><div class="sms">/i','<div class="sms-body-cont"><div class="sms-title">$1</div><div class="sms-body"><br>',$moddmydata); 

$opp=explode('<div class="sms-body-cont">',$moddmydata); 

fetch_sms_content($opp); 

?>  

</body>  
</html>

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

Attachments: prev2.png
just_m3. Developer · 199 posts #24

this script - IT'S DRIVING ME CRAZY !!

and i hate when people change their mind' and don't say what they wan't from the first time ... you know what i mean ..

i want that .. but that should be as that .. and have that .. creepy people ...

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

softwarefreak Senior · 349 posts #25

$file = curl_exec($ch);

if(!$file){echo'error grabbing content'; exit;}

@just_m3, OK,you'll show this to your visitors? 😀 "ERROR Grabbing content!" I think he/she will never ever come back to your site 😛

BTW,

$file = curl_exec($ch);

if(empty($file))
{
echo'error grabbing content';
 exit;
}

just_m3. wrote: this script - IT'S DRIVING ME CRAZY !!

and i hate when people change their mind' and don't say what they wan't from the first time ... you know what i mean ..

i want that .. but that should be as that .. and have that .. creepy people ...

It's not dat bad actually,I learnt new things from you guys 🙂

I need some facebook likes, can you please help me 🤝 http://facebook.com/softwarefreakin I noticed social media is really powerful 🧙 Well DONE is better than well SAID

just_m3. Developer · 199 posts #26

softwarefreak wrote: @just_m3, OK,you'll show this to your visitors? 😀 "ERROR Grabbing content!" I think he/she will never ever come back to your site 😛

BTW,

$file = curl_exec($ch);

if(empty($file))
{
echo'error grabbing content';
 exit;
}

It's not dat bad actually,I learnt new things from you guys :)

right bro' just keep him waiting on your page for like 40 seconds then throw him on a blank page 😀 .... jizz he is gonna' come back right away 🙂

You can put an error such as .. sorry time out during the server loads . please refresh the page !

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

softwarefreak Senior · 349 posts #27

@something, wats the significance of this?

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept-Language: '.$language,'Accept: '.$accept,'X-Forwarded-For: '.$ip));    

x-forwarded-for ? the ip...

I need some facebook likes, can you please help me 🤝 http://facebook.com/softwarefreakin I noticed social media is really powerful 🧙 Well DONE is better than well SAID

just_m3. Developer · 199 posts #28

softwarefreak wrote: @something, wats the significance of this?

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept-Language: '.$language,'Accept: '.$accept,'X-Forwarded-For: '.$ip));    

x-forwarded-for ? the ip...

yup .. for the forwarded ip so you can trick the grabbed site , or pass users ip via that header ... but it's not working on all sites because not all of them use xforwared to get users/visitors ip , beware that header ! an put some protection on your site if you are using forwarded ip .. because "someone else " 😊 could run some sql query injection ....

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

softwarefreak Senior · 349 posts #29

wow, thanks, I use this sometimes

<?php 
$url = "http://www.google.com.hk"; 

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_PROXY, 122.72.10.208); // a valid proxy,I get it 4rm  http://proxy-list.org/en/index.php
curl_setopt($ch, CURLOPT_PROXYPORT, 80); 

$exec = curl_exec($ch); 

curl_close($ch);
//echo curl_error($ch); 
echo $exec; 
    ?>

I need some facebook likes, can you please help me 🤝 http://facebook.com/softwarefreakin I noticed social media is really powerful 🧙 Well DONE is better than well SAID

slcash Developer · 75 posts #32

Lol . . .expret , . , . .hmm. . .ya . . .they are will be. . . . I thing we must coll them . . . Corder , . . .

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close