Solved

CURL, Client URL Library Functions-  Problem with URL

Posted on 2006-11-30
3
203 Views
Last Modified: 2008-03-17
I use simple CURL code:

in main.php page:
<?php
$c=curl_init();

curl_setopt ($c, CURLOPT_URL, "loadsite.php");
curl_setopt ($c, CURLOPT_REFERER, "referersite");
curl_exec ($c);
curl_close ($c);

?>

When the loadsite.php uses CSS defined in an extern file ( <link rel=StyleSheet href="css/style.css" type="text/css" media=screen>
), then the extern file is not loaded because the URL of the page in the browser is main.php and NOT loadsite.php.

How can I solve this problem?
0
Comment
Question by:jodavid
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 13

Accepted Solution

by:
rhickmott earned 250 total points
ID: 18044380
You could always use an preg_replace to replace all links with their full alternatives ie http://<site>/page.css

CURL will only pull one page at a time the only way you would be able to do it is rewrite the urld to css and images so they point at the ones on the original location or search for CSS links and then issue a seprate CURL to pull the style sheet and insert the source of that stylesheet inline into the page.
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question